mirror of https://github.com/Genymobile/scrcpy
Rename function to simplify
For consistency with sc_adb_parse_device(), do not include "from_output" in the function name.
This commit is contained in:
parent
55e65fa270
commit
b1d8c72780
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue