* split: function used to split a string with special separator. * parameter src OUT * parameter separator IN * parameter dest OUT * parameter num OUT * return ture if configuration parse succeeded, otherwise retrun false. */
| 19 | * return ture if configuration parse succeeded, otherwise retrun false. |
| 20 | */ |
| 21 | static bool |
| 22 | split(char *src, const char *separator, char **dest, int *num) |
| 23 | { |
| 24 | char *pNext; |
| 25 | int count = 0; |
| 26 | if (src == NULL || src[0] == '\0') |
| 27 | return false; |
| 28 | if (separator == NULL || separator[0] == '\0') |
| 29 | return false; |
| 30 | pNext = (char *)strtok(src,separator); |
| 31 | while (pNext != NULL) |
| 32 | { |
| 33 | *dest++ = pNext; |
| 34 | ++count; |
| 35 | pNext = (char *)strtok(NULL,separator); |
| 36 | } |
| 37 | *num = count; |
| 38 | return true; |
| 39 | } |
| 40 | |
| 41 | /* |
| 42 | * parseEtcdHostConfiguration: function used to parse etcdhost and etcdport inforamtion from a ETCD configure parameter. |
no outgoing calls
no test coverage detected