Changeset 3daf1979 in mainline
- Timestamp:
- 2014-06-30T20:30:24Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 23ce2d9
- Parents:
- 1bdf307d (diff), ee3f6f6 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- uspace
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/isa/isa.c
r1bdf307d r3daf1979 355 355 356 356 /* Get the name part of the rest of the line. */ 357 str tok(line, ":");357 str_tok(line, ":", NULL); 358 358 return line; 359 359 } -
uspace/lib/c/generic/str.c
r1bdf307d r3daf1979 1360 1360 } 1361 1361 1362 char *strtok(char *s, const char *delim) 1363 { 1364 static char *next; 1365 1366 return strtok_r(s, delim, &next); 1367 } 1368 1369 char *strtok_r(char *s, const char *delim, char **next) 1362 /** Split string by delimiters. 1363 * 1364 * @param s String to be tokenized. May not be NULL. 1365 * @param delim String with the delimiters. 1366 * @param next Variable which will receive the pointer to the 1367 * continuation of the string following the first 1368 * occurrence of any of the delimiter characters. 1369 * May be NULL. 1370 * @return Pointer to the prefix of @a s before the first 1371 * delimiter character. NULL if no such prefix 1372 * exists. 1373 */ 1374 char *str_tok(char *s, const char *delim, char **next) 1370 1375 { 1371 1376 char *start, *end; 1372 1377 1373 if (s == NULL) 1374 s = *next; 1378 if (!s) 1379 return NULL; 1380 1381 size_t len = str_size(s); 1382 size_t cur; 1383 size_t tmp; 1384 wchar_t ch; 1375 1385 1376 1386 /* Skip over leading delimiters. */ 1377 while (*s && (str_chr(delim, *s) != NULL)) ++s; 1378 start = s; 1387 for (tmp = cur = 0; 1388 (ch = str_decode(s, &tmp, len)) && str_chr(delim, ch); /**/) 1389 cur = tmp; 1390 start = &s[cur]; 1379 1391 1380 1392 /* Skip over token characters. */ 1381 while (*s && (str_chr(delim, *s) == NULL)) ++s; 1382 end = s; 1383 *next = (*s ? s + 1 : s); 1384 1385 if (start == end) { 1393 for (tmp = cur; 1394 (ch = str_decode(s, &tmp, len)) && !str_chr(delim, ch); /**/) 1395 cur = tmp; 1396 end = &s[cur]; 1397 if (next) 1398 *next = (ch ? &s[tmp] : &s[cur]); 1399 1400 if (start == end) 1386 1401 return NULL; /* No more tokens. */ 1387 }1388 1402 1389 1403 /* Overwrite delimiter with NULL terminator. */ -
uspace/lib/c/include/str.h
r1bdf307d r3daf1979 109 109 extern char *str_ndup(const char *, size_t max_size); 110 110 111 extern char *str_tok(char *, const char *, char **); 112 111 113 extern int str_uint8_t(const char *, const char **, unsigned int, bool, 112 114 uint8_t *); … … 132 134 extern unsigned long strtoul(const char *, char **, int); 133 135 134 extern char * strtok_r(char *, const char *, char **);135 extern char * strtok(char *, const char *);136 137 136 #endif 138 137 -
uspace/srv/fs/fat/fat_ops.c
r1bdf307d r3daf1979 930 930 /* Parse mount options. */ 931 931 char *mntopts = (char *) opts; 932 char *saveptr;933 932 char *opt; 934 while ((opt = str tok_r(mntopts, " ,", &saveptr)) != NULL) {933 while ((opt = str_tok(mntopts, " ,", &mntopts)) != NULL) { 935 934 if (str_cmp(opt, "wtcache") == 0) 936 935 cmode = CACHE_MODE_WT; 937 936 else if (str_cmp(opt, "nolfn") == 0) 938 937 instance->lfn_enabled = false; 939 mntopts = NULL;940 938 } 941 939 -
uspace/srv/logger/initlvl.c
r1bdf307d r3daf1979 44 44 { 45 45 char *tmp; 46 char *key = str tok_r(setting, "=", &tmp);47 char *value = str tok_r(NULL, "=", &tmp);46 char *key = str_tok(setting, "=", &tmp); 47 char *value = str_tok(tmp, "=", &tmp); 48 48 if (key == NULL) 49 49 return; … … 76 76 { 77 77 char *tmp; 78 char *single_setting = str tok_r(settings, " ", &tmp);78 char *single_setting = str_tok(settings, " ", &tmp); 79 79 while (single_setting != NULL) { 80 80 parse_single_level_setting(single_setting); 81 single_setting = str tok_r(NULL, " ", &tmp);81 single_setting = str_tok(tmp, " ", &tmp); 82 82 } 83 83 }
Note:
See TracChangeset
for help on using the changeset viewer.