Revert "Remove all uses of G_CONST_RETURN"
[platform/upstream/glib.git] / glib / gconvert.c
index 12c010d..b363bca 100644 (file)
@@ -21,8 +21,7 @@
  */
 
 #include "config.h"
-
-#include "glib.h"
+#include "glibconfig.h"
 
 #ifndef G_OS_WIN32
 #include <iconv.h>
 #include <string.h>
 #include <stdlib.h>
 
-#include "gprintfint.h"
-#include "gthreadprivate.h"
-#include "gunicode.h"
-
 #ifdef G_OS_WIN32
 #include "win_iconv.c"
 #endif
 #undef STRICT
 #endif
 
+#include "gconvert.h"
+
+#include "gprintfint.h"
+#include "gslist.h"
+#include "gstrfuncs.h"
+#include "gtestutils.h"
+#include "gthread.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)
@@ -759,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;
            }