Changeset 791f58c in mainline for uspace/srv/devman/util.h
- 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.h
rc6c389ed r791f58c 41 41 extern char *get_path_elem_end(char *); 42 42 43 static inline bool skip_spaces(char **buf) 44 { 45 while (isspace(**buf)) 46 (*buf)++; 47 return *buf != 0; 48 } 49 50 static inline size_t get_nonspace_len(const char *str) 51 { 52 size_t len = 0; 53 54 while(*str != '\0' && !isspace(*str)) { 55 len++; 56 str++; 57 } 58 59 return len; 60 } 61 62 static inline void free_not_null(const void *ptr) 63 { 64 if (ptr != NULL) 65 free(ptr); 66 } 67 68 static inline char *clone_string(const char *s) 69 { 70 size_t size = str_size(s) + 1; 71 char *str; 72 73 str = (char *) malloc(size); 74 if (str != NULL) 75 str_cpy(str, size, s); 76 return str; 77 } 78 79 static inline void replace_char(char *str, char orig, char repl) 80 { 81 while (*str) { 82 if (*str == orig) 83 *str = repl; 84 str++; 85 } 86 } 43 extern bool skip_spaces(char **); 44 extern size_t get_nonspace_len(const char *); 45 extern void free_not_null(const void *); 46 extern char *clone_string(const char *); 47 extern void replace_char(char *, char, char); 87 48 88 49 #endif
Note:
See TracChangeset
for help on using the changeset viewer.