Changeset 38b3baf in mainline for uspace/srv/devman/util.h
- Timestamp:
- 2010-10-23T07:16:14Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7e66a5ec
- Parents:
- 032e0bb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/util.h
r032e0bb r38b3baf 30 30 * @{ 31 31 */ 32 32 33 33 #ifndef DEVMAN_UTIL_H_ 34 34 #define DEVMAN_UTIL_H_ … … 38 38 #include <malloc.h> 39 39 40 extern char *get_abs_path(const char *, const char *, const char *); 41 extern char *get_path_elem_end(char *); 40 42 41 char * get_abs_path(const char *base_path, const char *name, const char *ext); 42 char * get_path_elem_end(char *path); 43 44 static inline bool skip_spaces(char **buf) 43 static inline bool skip_spaces(char **buf) 45 44 { 46 while (isspace(**buf)) { 47 (*buf)++; 48 } 49 return *buf != 0; 45 while (isspace(**buf)) 46 (*buf)++; 47 return *buf != 0; 50 48 } 51 49 52 static inline size_t get_nonspace_len(const char *str) 50 static inline size_t get_nonspace_len(const char *str) 53 51 { 54 52 size_t len = 0; 53 55 54 while(*str != 0 && !isspace(*str)) { 56 55 len++; … … 62 61 static inline void free_not_null(const void *ptr) 63 62 { 64 if (NULL != ptr) {63 if (NULL != ptr) 65 64 free(ptr); 66 }67 65 } 68 66 69 static inline char * clone_string(const char *s)67 static inline char *clone_string(const char *s) 70 68 { 71 69 size_t size = str_size(s) + 1; 72 char *str = (char *)malloc(size); 73 if (NULL != str) { 70 char *str; 71 72 str = (char *) malloc(size); 73 if (NULL != str) 74 74 str_cpy(str, size, s); 75 }76 75 return str; 77 76 } … … 80 79 { 81 80 while (*str) { 82 if (orig == *str) {81 if (orig == *str) 83 82 *str = repl; 84 }85 83 str++; 86 84 } … … 88 86 89 87 #endif 88 89 /** @} 90 */
Note:
See TracChangeset
for help on using the changeset viewer.