diff options
Diffstat (limited to 'contrib/ofed/usr.lib/libibverbs/alloca.h')
-rw-r--r-- | contrib/ofed/usr.lib/libibverbs/alloca.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/contrib/ofed/usr.lib/libibverbs/alloca.h b/contrib/ofed/usr.lib/libibverbs/alloca.h new file mode 100644 index 0000000..b0311c0 --- /dev/null +++ b/contrib/ofed/usr.lib/libibverbs/alloca.h @@ -0,0 +1,18 @@ +#ifndef _LIBIBVERBS_ALLOCA_H_ +#define _LIBIBVERBS_ALLOCA_H_ +#include <stdlib.h> +#include <string.h> +#include <stdlib.h> + +#define strdupa(_s) \ +({ \ + char *_d; \ + int _len; \ + \ + _len = strlen(_s) + 1; \ + _d = alloca(_len); \ + if (_d) \ + memcpy(_d, _s, _len); \ + _d; \ +}) +#endif /* _LIBIBVERBS_ALLOCA_H_ */ |