| 32 |
32 |
| 33 const unsigned char * |
33 const unsigned char * |
| 34 gaim_network_ip_atoi(const char *ip) |
34 gaim_network_ip_atoi(const char *ip) |
| 35 { |
35 { |
| 36 static unsigned char ret[4]; |
36 static unsigned char ret[4]; |
| 37 gchar delimiter = '.'; |
37 gchar *delimiter = "."; |
| 38 gchar **split; |
38 gchar **split; |
| 39 int i; |
39 int i; |
| 40 |
40 |
| 41 g_return_val_if_fail(ip != NULL, NULL); |
41 g_return_val_if_fail(ip != NULL, NULL); |
| 42 |
42 |
| 43 split = g_strsplit(ip, &delimiter, 4); |
43 split = g_strsplit(ip, delimiter, 4); |
| 44 for (i = 0; split[i] != NULL; i++) |
44 for (i = 0; split[i] != NULL; i++) |
| 45 ret[i] = atoi(split[i]); |
45 ret[i] = atoi(split[i]); |
| 46 g_strfreev(split); |
46 g_strfreev(split); |
| 47 |
47 |
| 48 /* i should always be 4 */ |
48 /* i should always be 4 */ |