Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/devman/util.c

    r791f58c r38b3baf  
    6161char *get_path_elem_end(char *path)
    6262{
    63         while (*path != '\0' && *path != '/')
     63        while (0 != *path && '/' != *path)
    6464                path++;
    6565        return path;
    6666}
    6767
    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 
    11368/** @}
    11469 */
Note: See TracChangeset for help on using the changeset viewer.