# include <limits.h>
#endif
-#include "strdup.h"
#include "c-strcase.h"
#ifndef SIZE_MAX
char *
str_iconv (const char *src, const char *from_codeset, const char *to_codeset)
{
- if (c_strcasecmp (from_codeset, to_codeset) == 0)
- return strdup (src);
+ if (*src == '\0' || c_strcasecmp (from_codeset, to_codeset) == 0)
+ {
+ char *result = strdup (src);
+
+ if (result == NULL)
+ errno = ENOMEM;
+ return result;
+ }
else
{
#if HAVE_ICONV