1290000Sglebius#include <config.h> 2290000Sglebius 3290000Sglebius#include <ntp_assert.h> 4106163Sroberto#include "ntp_malloc.h" 5290000Sglebius#include <string.h> 682498Sroberto 7290000Sglebius#ifndef HAVE_STRDUP 8106163Sroberto 9106163Srobertochar *strdup(const char *s); 10106163Sroberto 1182498Srobertochar * 1282498Srobertostrdup( 1382498Sroberto const char *s 1482498Sroberto ) 1582498Sroberto{ 16290000Sglebius size_t octets; 17290000Sglebius char * cp; 1882498Sroberto 19290000Sglebius REQUIRE(s); 20290000Sglebius octets = strlen(s) + 1; 21290000Sglebius if ((cp = malloc(octets)) == NULL) 22290000Sglebius return NULL; 23290000Sglebius memcpy(cp, s, octets); 24290000Sglebius 25290000Sglebius return cp; 2682498Sroberto} 27106163Sroberto#else 28290000Sglebiusint strdup_c_nonempty_compilation_unit; 29106163Sroberto#endif 30