diff --git a/app/src/adb/adb.c b/app/src/adb/adb.c index 344f7fcc..8b92a2b0 100644 --- a/app/src/adb/adb.c +++ b/app/src/adb/adb.c @@ -710,5 +710,5 @@ sc_adb_get_device_ip(struct sc_intr *intr, const char *serial, unsigned flags) { // It is parsed as a NUL-terminated string buf[r] = '\0'; - return sc_adb_parse_device_ip_from_output(buf); + return sc_adb_parse_device_ip(buf); } diff --git a/app/src/adb/adb_parser.c b/app/src/adb/adb_parser.c index 933eafbb..ab121347 100644 --- a/app/src/adb/adb_parser.c +++ b/app/src/adb/adb_parser.c @@ -199,7 +199,7 @@ sc_adb_parse_device_ip_from_line(char *line) { } char * -sc_adb_parse_device_ip_from_output(char *str) { +sc_adb_parse_device_ip(char *str) { size_t idx_line = 0; while (str[idx_line] != '\0') { char *line = &str[idx_line]; diff --git a/app/src/adb/adb_parser.h b/app/src/adb/adb_parser.h index e0cc389b..f20349f6 100644 --- a/app/src/adb/adb_parser.h +++ b/app/src/adb/adb_parser.h @@ -25,6 +25,6 @@ sc_adb_parse_devices(char *str, struct sc_vec_adb_devices *out_vec); * Warning: this function modifies the buffer for optimization purposes. */ char * -sc_adb_parse_device_ip_from_output(char *str); +sc_adb_parse_device_ip(char *str); #endif diff --git a/app/tests/test_adb_parser.c b/app/tests/test_adb_parser.c index 6506122f..d95e7ef2 100644 --- a/app/tests/test_adb_parser.c +++ b/app/tests/test_adb_parser.c @@ -167,7 +167,7 @@ static void test_get_ip_single_line(void) { char ip_route[] = "192.168.1.0/24 dev wlan0 proto kernel scope link src " "192.168.12.34\r\r\n"; - char *ip = sc_adb_parse_device_ip_from_output(ip_route); + char *ip = sc_adb_parse_device_ip(ip_route); assert(ip); assert(!strcmp(ip, "192.168.12.34")); free(ip); @@ -177,7 +177,7 @@ static void test_get_ip_single_line_without_eol(void) { char ip_route[] = "192.168.1.0/24 dev wlan0 proto kernel scope link src " "192.168.12.34"; - char *ip = sc_adb_parse_device_ip_from_output(ip_route); + char *ip = sc_adb_parse_device_ip(ip_route); assert(ip); assert(!strcmp(ip, "192.168.12.34")); free(ip); @@ -187,7 +187,7 @@ static void test_get_ip_single_line_with_trailing_space(void) { char ip_route[] = "192.168.1.0/24 dev wlan0 proto kernel scope link src " "192.168.12.34 \n"; - char *ip = sc_adb_parse_device_ip_from_output(ip_route); + char *ip = sc_adb_parse_device_ip(ip_route); assert(ip); assert(!strcmp(ip, "192.168.12.34")); free(ip); @@ -199,7 +199,7 @@ static void test_get_ip_multiline_first_ok(void) { "10.0.0.0/24 dev rmnet proto kernel scope link src " "10.0.0.2\r\n"; - char *ip = sc_adb_parse_device_ip_from_output(ip_route); + char *ip = sc_adb_parse_device_ip(ip_route); assert(ip); assert(!strcmp(ip, "192.168.1.2")); free(ip); @@ -211,7 +211,7 @@ static void test_get_ip_multiline_second_ok(void) { "192.168.1.0/24 dev wlan0 proto kernel scope link src " "192.168.1.3\r\n"; - char *ip = sc_adb_parse_device_ip_from_output(ip_route); + char *ip = sc_adb_parse_device_ip(ip_route); assert(ip); assert(!strcmp(ip, "192.168.1.3")); free(ip); @@ -221,7 +221,7 @@ static void test_get_ip_no_wlan(void) { char ip_route[] = "192.168.1.0/24 dev rmnet proto kernel scope link src " "192.168.12.34\r\r\n"; - char *ip = sc_adb_parse_device_ip_from_output(ip_route); + char *ip = sc_adb_parse_device_ip(ip_route); assert(!ip); } @@ -229,7 +229,7 @@ static void test_get_ip_no_wlan_without_eol(void) { char ip_route[] = "192.168.1.0/24 dev rmnet proto kernel scope link src " "192.168.12.34"; - char *ip = sc_adb_parse_device_ip_from_output(ip_route); + char *ip = sc_adb_parse_device_ip(ip_route); assert(!ip); } @@ -237,7 +237,7 @@ static void test_get_ip_truncated(void) { char ip_route[] = "192.168.1.0/24 dev rmnet proto kernel scope link src " "\n"; - char *ip = sc_adb_parse_device_ip_from_output(ip_route); + char *ip = sc_adb_parse_device_ip(ip_route); assert(!ip); }