2 I debated about putting this in the client library since it does an
3 action I don't really believe belongs in the library.
5 Frankly its too damn useful not to be here though.
10 memcached_server_st
*memcached_servers_parse(char *server_strings
)
16 memcached_server_st
*servers
= NULL
;
19 assert(server_strings
);
21 end_ptr
= server_strings
+ strlen(server_strings
);
23 for (begin_ptr
= server_strings
, string
= index(server_strings
, ',');
25 string
= index(begin_ptr
, ','))
27 char buffer
[HUGE_STRING_LEN
];
31 memset(buffer
, 0, HUGE_STRING_LEN
);
34 memcpy(buffer
, begin_ptr
, string
- begin_ptr
);
39 size_t length
= strlen(begin_ptr
);
40 memcpy(buffer
, begin_ptr
, length
);
44 ptr
= index(buffer
, ':');
52 port
= strtol(ptr
, (char **)NULL
, 10);
55 servers
= memcached_server_list_append(servers
, buffer
, port
, &rc
);
57 if (isspace(*begin_ptr
))