Changeset 60898b6 in mainline for uspace/srv/devman/util.c
- Timestamp:
- 2010-11-05T16:17:48Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 08042bd
- Parents:
- a63ff7d (diff), a66e2993 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/util.c
ra63ff7d r60898b6 61 61 char *get_path_elem_end(char *path) 62 62 { 63 while ( 0 != *path && '/' != *path)63 while (*path != '\0' && *path != '/') 64 64 path++; 65 65 return path; 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.