diff lib/uniconv/u-strconv-from-enc.h @ 11511:d604b921ed8d

Simplify calling convention of u*_conv_from_encoding.
author Bruno Haible <bruno@clisp.org>
date Sun, 26 Apr 2009 16:43:25 +0200 (2009-04-26)
parents ad8a75a45dc9
children e8d2c6fc33ad
line wrap: on
line diff
--- a/lib/uniconv/u-strconv-from-enc.h
+++ b/lib/uniconv/u-strconv-from-enc.h
@@ -1,5 +1,5 @@
 /* Conversion to UTF-8/UTF-16/UTF-32 from legacy encodings.
-   Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2006-2007, 2009 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify it
    under the terms of the GNU Lesser General Public License as published
@@ -19,12 +19,14 @@
       const char *fromcode,
       enum iconv_ilseq_handler handler)
 {
-  UNIT *result = NULL;
-  size_t length = 0;
+  UNIT *result;
+  size_t length;
 
-  if (U_CONV_FROM_ENCODING (fromcode, handler,
-			    string, strlen (string) + 1, NULL,
-			    &result, &length) < 0)
+  result =
+    U_CONV_FROM_ENCODING (fromcode, handler,
+			  string, strlen (string) + 1, NULL,
+			  NULL, &length);
+  if (result == NULL)
     return NULL;
   /* Verify the result has exactly one NUL unit, at the end.  */
   if (!(length > 0 && result[length-1] == 0