On Tue, Jan 4, 2011 at 7:53 PM, Vincent Torri <vto...@univ-evry.fr> wrote: > On Tue, 4 Jan 2011, Mike Blumenkrantz wrote: > >> In my efm hacking, I've found a number of snippets like this: >> >> size = strlen(v->udi) + 1; >> buf = alloca(size); >> strcpy(buf, v->udi); >> ecore_ipc_server_send(_e_fm_ipc_server, >> 6 /*E_IPC_DOMAIN_FM*/, >> E_FM_OP_EJECT_DONE, >> 0, 0, 0, buf, size); >> >> Is there a reason why we can't just use strdupa? It should be about as >> portable as alloca... > > strdupa is not portable at all. It is part of the glibc (it's a GNU > stuff).
given that the above code does exactly what strdupa() would do, why not use it and save lines, defining a strdupa() macro where not available? something like this should do: #define stdupa(str) strcpy(alloca(strlen(str) + 1), str) -- Gustavo Sverzut Barbieri http://profusion.mobi embedded systems -------------------------------------- MSN: barbi...@gmail.com Skype: gsbarbieri Mobile: +55 (19) 9225-2202 ------------------------------------------------------------------------------ Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel