[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Remove some #ifdefs
From: |
Jim Meyering |
Subject: |
[PATCH] Remove some #ifdefs |
Date: |
Tue, 13 Feb 2007 17:10:18 +0100 |
Remove some #ifdefs.
* parted/table.c (L_): define.
Remove in-function #ifdefs; use L_(str) instead.
Signed-off-by: Jim Meyering <address@hidden>
---
parted/table.c | 38 ++++++++++----------------------------
1 files changed, 10 insertions(+), 28 deletions(-)
diff --git a/parted/table.c b/parted/table.c
index acd7ce1..1f8572d 100644
--- a/parted/table.c
+++ b/parted/table.c
@@ -3,7 +3,7 @@
*/
/*
parted - a frontend to libparted
- Copyright (C) 2006
+ Copyright (C) 2006-2007
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
@@ -34,7 +34,9 @@
# define _GNU_SOURCE
# 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
@@ -52,13 +54,8 @@
static const unsigned int MAX_WIDTH = 512;
-#ifdef ENABLE_NLS
-static const wchar_t* DELIMITER = L" ";
-static const wchar_t* COLSUFFIX = L"\n";
-#else
-static const wchar_t* DELIMITER = " ";
-static const wchar_t* COLSUFFIX = "\n";
-#endif
+static const wchar_t* DELIMITER = L_(" ");
+static const wchar_t* COLSUFFIX = L_("\n");
typedef struct
{
@@ -209,12 +206,8 @@ static void table_render_row (Table* t, int rownum, int
ncols, wchar_t** s)
for (j = 0; j < nspaces; ++j)
pad[j] = L' ';
-#ifdef ENABLE_NLS
- pad[nspaces] = L'\0';
-#else
- pad[nspaces] = '\0';
-#endif
-
+ pad[nspaces] = L_('\0');
+
wcscat (*s, row[i]);
wcscat (*s, pad);
if (i + 1 < ncols)
@@ -235,12 +228,7 @@ static void table_render_rows (Table* t, wchar_t** s)
{
unsigned int i;
-#ifdef ENABLE_NLS
- assert (**s == L'\0');
-#else
- assert (**s == '\0');
-#endif
-
+ assert (**s == L_('\0'));
for (i = 0; i < t->nrows; ++i)
table_render_row (t, i, t->ncols, s);
}
@@ -252,14 +240,8 @@ static void table_render_rows (Table* t, wchar_t** s)
wchar_t* table_render(Table* t)
{
wchar_t* s = malloc(sizeof(wchar_t));
-#ifdef ENABLE_NLS
- *s = L'\0';
-#else
- *s = '\0';
-#endif
-
+
+ *s = L_('\0');
table_render_rows (t, &s);
-
return s;
}
-
--
1.5.0.rc4.26.gcc46a-dirty
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] Remove some #ifdefs,
Jim Meyering <=