Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(301)

Side by Side Diff: nih/string.c

Issue 524041: Changes to make upstart log performance stats to a file. (Closed)
Patch Set: More tab/space stuff Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « make_pkg.sh ('k') | nih/tests/test_string.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* libnih 1 /* libnih
2 * 2 *
3 * string.c - useful string utility functions 3 * string.c - useful string utility functions
4 * 4 *
5 * Copyright © 2009 Scott James Remnant <scott@netsplit.com>. 5 * Copyright © 2009 Scott James Remnant <scott@netsplit.com>.
6 * Copyright © 2009 Canonical Ltd. 6 * Copyright © 2009 Canonical Ltd.
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2, as 9 * it under the terms of the GNU General Public License version 2, as
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 398
399 len = 0; 399 len = 0;
400 array = nih_str_array_new (parent); 400 array = nih_str_array_new (parent);
401 if (! array) 401 if (! array)
402 return NULL; 402 return NULL;
403 403
404 while (*str) { 404 while (*str) {
405 const char *ptr; 405 const char *ptr;
406 406
407 /* Skip initial delimiters */ 407 /* Skip initial delimiters */
408 » » while (repeat && strchr (delim, *str)) 408 » » while (repeat && *str && strchr (delim, *str))
409 str++; 409 str++;
410 410
411 if (! *str)
412 break;
413
411 /* Find the end of the token */ 414 /* Find the end of the token */
412 ptr = str; 415 ptr = str;
413 while (*str && (! strchr (delim, *str))) 416 while (*str && (! strchr (delim, *str)))
414 str++; 417 str++;
415 418
416 if (! nih_str_array_addn (&array, parent, &len, 419 if (! nih_str_array_addn (&array, parent, &len,
417 ptr, str - ptr)) { 420 ptr, str - ptr)) {
418 nih_free (array); 421 nih_free (array);
419 return NULL; 422 return NULL;
420 } 423 }
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 size_t indent) 950 size_t indent)
948 { 951 {
949 size_t len; 952 size_t len;
950 953
951 nih_assert (str != NULL); 954 nih_assert (str != NULL);
952 955
953 len = nih_str_screen_width () - 1; 956 len = nih_str_screen_width () - 1;
954 957
955 return nih_str_wrap (parent, str, len, first_indent, indent); 958 return nih_str_wrap (parent, str, len, first_indent, indent);
956 } 959 }
OLDNEW
« no previous file with comments | « make_pkg.sh ('k') | nih/tests/test_string.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698