Changeset 60898b6 in mainline for uspace/srv/devman/util.c


Ignore:
Timestamp:
2010-11-05T16:17:48Z (13 years ago)
Author:
Jakub Jermar <jakub@…>
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.
Message:

Merge mainline changes.

File:
1 edited

Legend:

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

    ra63ff7d r60898b6  
    6161char *get_path_elem_end(char *path)
    6262{
    63         while (0 != *path && '/' != *path)
     63        while (*path != '\0' && *path != '/')
    6464                path++;
    6565        return path;
    6666}
    6767
     68bool skip_spaces(char **buf)
     69{
     70        while (isspace(**buf))
     71                (*buf)++;
     72        return *buf != 0;
     73}
     74
     75size_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
     87void free_not_null(const void *ptr)
     88{
     89        if (ptr != NULL)
     90                free(ptr);
     91}
     92
     93char *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
     104void replace_char(char *str, char orig, char repl)
     105{
     106        while (*str) {
     107                if (*str == orig)
     108                        *str = repl;
     109                str++;
     110        }
     111}
     112
    68113/** @}
    69114 */
Note: See TracChangeset for help on using the changeset viewer.