Changeset 791f58c in mainline for uspace/srv/devman/util.c
- Timestamp:
- 2010-10-23T16:42:08Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 713a4b9
- Parents:
- c6c389ed
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/util.c
rc6c389ed r791f58c 66 66 } 67 67 68 bool skip_spaces(char **buf) 69 { 70 while (isspace(**buf)) 71 (*buf)++; 72 return *buf != 0; 73 } 74 75 size_t get_nonspace_len(const char *str) 76 { 77 size_t len = 0; 78 79 while(*str != '\0' && !isspace(*str)) { 80 len++; 81 str++; 82 } 83 84 return len; 85 } 86 87 void free_not_null(const void *ptr) 88 { 89 if (ptr != NULL) 90 free(ptr); 91 } 92 93 char *clone_string(const char *s) 94 { 95 size_t size = str_size(s) + 1; 96 char *str; 97 98 str = (char *) malloc(size); 99 if (str != NULL) 100 str_cpy(str, size, s); 101 return str; 102 } 103 104 void replace_char(char *str, char orig, char repl) 105 { 106 while (*str) { 107 if (*str == orig) 108 *str = repl; 109 str++; 110 } 111 } 112 68 113 /** @} 69 114 */
Note:
See TracChangeset
for help on using the changeset viewer.