Changeset 8e7c9fe in mainline for uspace/lib/c/generic/io/asprintf.c


Ignore:
Timestamp:
2014-09-12T03:45:25Z (10 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c53b58e
Parents:
3eb0c85 (diff), 105d8d6 (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

most usb changes were reverted. blink and usbmass were fixed
known problems:
ehci won't initialize
usbmast asserts on unmount (happens on mainline too)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/io/asprintf.c

    r3eb0c85 r8e7c9fe  
    7676 *             the newly allocated string.
    7777 * @fmt        Format string.
     78 * @args       Variable argument list
     79 *
     80 * @return Number of characters printed or a negative error code.
     81 *
     82 */
     83int vasprintf(char **strp, const char *fmt, va_list args)
     84{
     85        va_list args2;
     86        va_copy(args2, args);
     87        int ret = vprintf_size(fmt, args2);
     88        va_end(args2);
     89       
     90        if (ret > 0) {
     91                *strp = malloc(STR_BOUNDS(ret) + 1);
     92                if (*strp == NULL)
     93                        return -1;
     94               
     95                vsnprintf(*strp, STR_BOUNDS(ret) + 1, fmt, args);
     96        }
     97       
     98        return ret;
     99}
     100
     101/** Allocate and print to string.
     102 *
     103 * @param strp Address of the pointer where to store the address of
     104 *             the newly allocated string.
     105 * @fmt        Format string.
    78106 *
    79107 * @return Number of characters printed or a negative error code.
     
    84112        va_list args;
    85113        va_start(args, fmt);
    86         int ret = vprintf_size(fmt, args);
     114        int ret = vasprintf(strp, fmt, args);
    87115        va_end(args);
    88        
    89         if (ret > 0) {
    90                 *strp = malloc(STR_BOUNDS(ret) + 1);
    91                 if (*strp == NULL)
    92                         return -1;
    93                
    94                 va_start(args, fmt);
    95                 vsnprintf(*strp, STR_BOUNDS(ret) + 1, fmt, args);
    96                 va_end(args);
    97         }
    98116       
    99117        return ret;
Note: See TracChangeset for help on using the changeset viewer.