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.
11 memcached_server_st
*memcached_servers_parse(char *server_strings
)
17 memcached_server_st
*servers
= NULL
;
20 WATCHPOINT_ASSERT(server_strings
);
22 end_ptr
= server_strings
+ strlen(server_strings
);
24 for (begin_ptr
= server_strings
, string
= index(server_strings
, ',');
26 string
= index(begin_ptr
, ','))
28 char buffer
[HUGE_STRING_LEN
];
34 memcpy(buffer
, begin_ptr
, string
- begin_ptr
);
35 buffer
[(unsigned int)(string
- begin_ptr
)]= 0;
40 size_t length
= strlen(begin_ptr
);
41 memcpy(buffer
, begin_ptr
, length
);
46 ptr
= index(buffer
, ':');
54 port
= strtol(ptr
, (char **)NULL
, 10);
57 servers
= memcached_server_list_append(servers
, buffer
, port
, &rc
);
59 if (isspace(*begin_ptr
))