add NEED_STRDUP for C89 support
C89 does not define strdup(), so provide an implementation for the systems that doesn't implement it. Enable it by adding "CPPFLAG += -DNEED_STRDUP" to config.mak.
This commit is contained in:
parent
ab243a6c1a
commit
ca123707b3
11
sync/base.h
11
sync/base.h
@ -71,4 +71,15 @@ static inline int xrecv(SOCKET s, void *buf, size_t len, int flags)
|
|||||||
return recv(s, (char *)buf, len, flags) != (int)len;
|
return recv(s, (char *)buf, len, flags) != (int)len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef NEED_STRDUP
|
||||||
|
static inline char *rocket_strdup(const char *str)
|
||||||
|
{
|
||||||
|
char *ret = malloc(strlen(str) + 1);
|
||||||
|
if (ret)
|
||||||
|
strcpy(ret, str);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#define strdup rocket_strdup
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* SYNC_BASE_H */
|
#endif /* SYNC_BASE_H */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user