Changeset a6480d5 in mainline for uspace/lib/c/generic/str.c


Ignore:
Timestamp:
2011-08-21T11:44:59Z (13 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
25c1b2c, bd5f3b7, d1e196f7
Parents:
c22531fc (diff), 1877128 (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.
git-author:
Martin Sucha <> (2011-08-21 11:44:59)
git-committer:
Martin Decky <martin@…> (2011-08-21 11:44:59)
Message:

merge Martin Sucha's fixes and improvements

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/str.c

    rc22531fc ra6480d5  
    22 * Copyright (c) 2005 Martin Decky
    33 * Copyright (c) 2008 Jiri Svoboda
     4 * Copyright (c) 2011 Martin Sucha
    45 * All rights reserved.
    56 *
     
    718719
    719720        dest[dlen - 1] = '\0';
     721}
     722
     723/** Convert string to wide string.
     724 *
     725 * Convert string @a src to wide string. A new wide NULL-terminated
     726 * string will be allocated on the heap.
     727 *
     728 * @param src   Source string.
     729 */
     730wchar_t *str_to_awstr(const char *str)
     731{
     732        size_t len = str_length(str);
     733        wchar_t *wstr = calloc(len+1, sizeof(wchar_t));
     734        if (wstr == NULL) {
     735                return NULL;
     736        }
     737        str_to_wstr(wstr, len+1, str);
     738        return wstr;
    720739}
    721740
Note: See TracChangeset for help on using the changeset viewer.