summaryrefslogtreecommitdiff
path: root/strdupa.h
blob: b158f4d1531f0685e168a62bb53d00fc536757b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#ifndef __DDB_PLATFORM_H
#define __DDB_PLATFORM_H

#include <string.h>

#ifndef strdupa
# define strdupa(s)							      \
    ({									      \
      const char *old = (s);					      \
      size_t len = strlen (old) + 1;				      \
      char *new = (char *) alloca (len);			      \
      (char *) memcpy (new, old, len);				      \
    })
#endif

#endif