Revert "Remove all uses of G_CONST_RETURN"
[platform/upstream/glib.git] / glib / gconvert.c
index e44a772..b363bca 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 #include "config.h"
+#include "glibconfig.h"
 
 #ifndef G_OS_WIN32
 #include <iconv.h>
 #include "gthreadprivate.h"
 #include "gunicode.h"
 
+#ifdef NEED_ICONV_CACHE
+#include "glist.h"
+#include "ghash.h"
+#endif
+
 #include "glibintl.h"
 
 #if defined(USE_LIBICONV_GNU) && !defined (_LIBICONV_H)
@@ -763,13 +769,14 @@ g_convert_with_iconv (const gchar *str,
              have_error = TRUE;
              break;
            default:
-              {
-                int errsv = errno;
-                
-                g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED,
-                             _("Error during conversion: %s"),
-                             g_strerror (errsv));
-              }
+             if (error)
+                {
+                  int errsv = errno;
+
+                  g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED,
+                               _("Error during conversion: %s"),
+                               g_strerror (errsv));
+                }
              have_error = TRUE;
              break;
            }