[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: DeviceKit and /usr



Le lundi 07 septembre 2009 à 13:40 +0200, Bernhard R. Link a écrit : 
> For the record: Noone sane would replace g_strdup_printf with snprintf,
> but with asprintf.

Case 1:
        char *foo;
        if (asprintf(&foo, "%s equals %i", somestring, someint) < 0) {
                fprintf(stderr, "Failed to allocate memory");
                abort();
        }

Case 2:
        char *foo = g_strdup_printf ("%s equals %i", somestring,
        someint);

Pick your choice.

-- 
 .''`.      Josselin Mouette
: :' :
`. `'   “I recommend you to learn English in hope that you in
  `-     future understand things”  -- Jörg Schilling

Attachment: signature.asc
Description: Ceci est une partie de message =?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?=


Reply to: