OSDN Git Service

Fix build failure (conflicting decl of strnlen) and clean up
authorJim Meyering <jim@meyering.net>
Thu, 31 May 2007 07:04:01 +0000 (09:04 +0200)
committerJim Meyering <jim@meyering.net>
Thu, 31 May 2007 08:41:52 +0000 (10:41 +0200)
* parted/strlist.h: Include <config.h> first.
[!ENABLE_NLS]: Define wchar_t to char here, too, since we no
longer include "strlist.h" after the definition in table.c.
* parted/table.c: Include <wchar.h> and <string.h> unconditionally,
and before wchar_t redefinition.
Hoist inclusions of xalloc.h and strlist.h, too.
Remove wcwidth and strnlen declarations, since they're guaranteed
to be in the gnulib-supplied-if-needed headers.

parted/strlist.h
parted/table.c

index e458ba1..39efb4b 100644 (file)
@@ -1,6 +1,6 @@
 /*
     parted - a frontend to libparted
-    Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+    Copyright (C) 1999, 2000, 2001, 2007 Free Software Foundation, Inc.
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 #ifndef STRLIST_H_INCLUDED
 #define STRLIST_H_INCLUDED
 
+#include <config.h>
+
 #include <wchar.h>
 
+#ifndef ENABLE_NLS
+#      define L_(str) str
+#       ifdef wchar_t
+#               undef wchar_t
+#       endif
+#       define wchar_t char
+#endif
+
 typedef struct _StrList StrList;
 struct _StrList {
        StrList*        next;
index 1301549..3c2edf2 100644 (file)
 #include <stdlib.h>
 
 #include <assert.h>
+#include <wchar.h>
+#include <string.h>
 
+#include "xalloc.h"
+#include "strlist.h"
 
 #ifdef ENABLE_NLS
-#       include <wchar.h>
-        int wcswidth (const wchar_t *s, size_t n);
 #      define L_(str) L##str
 #else
 #      define L_(str) str
 #       ifdef wchar_t
 #               undef wchar_t
 #       endif
-#       include <string.h>
 #       define wchar_t char
 #       define wcslen strlen
 #       define wcswidth strnlen
 #       define wcscat strcat
 #       define wcsdup strdup
-        size_t strnlen (const char *, size_t);
 #endif
 
-#include "xalloc.h"
-#include "strlist.h"
-
 
 static const unsigned int       MAX_WIDTH = 512;
 static const wchar_t*           DELIMITER = L_("  ");