xfs
[Top] [All Lists]

[PATCH 2/6] Fix build when gettext is enabled.

To: linux-xfs@xxxxxxxxxxx
Subject: [PATCH 2/6] Fix build when gettext is enabled.
From: Arkadiusz Miskiewicz <arekm@xxxxxxxx>
Date: Mon, 15 Dec 2008 20:29:42 +0100
Cc: Arkadiusz Miskiewicz <arekm@xxxxxxxx>
In-reply-to: <1229369386-66312-1-git-send-email-arekm@xxxxxxxx>
References: <1229369386-66312-1-git-send-email-arekm@xxxxxxxx>
Build fails when gettext is enabled:

progress.c:16: error: initializer element is not constant
progress.c:16: error: (near initialization for ‘rpt_types[0]’)
progress.c:18: error: initializer element is not constant
progress.c:18: error: (near initialization for ‘rpt_types[1]’)
[...]

Fix that using commonly standard N_() macro.

Patch by Jakub Bogusz <qboosh@xxxxxxxxxxxxx>.
Improvements by Arkadiusz Miśkiewicz <arekm@xxxxxxxx>.
---
 xfsprogs/include/buildrules         |    2 +-
 xfsprogs/include/platform_defs.h.in |    2 +
 xfsprogs/repair/progress.c          |   50 +++++++++++++++++-----------------
 3 files changed, 28 insertions(+), 26 deletions(-)

diff --git a/xfsprogs/include/buildrules b/xfsprogs/include/buildrules
index 7155b21..1047ec3 100644
--- a/xfsprogs/include/buildrules
+++ b/xfsprogs/include/buildrules
@@ -40,7 +40,7 @@ endif
 
 ifdef POTHEAD
 $(POTHEAD): $(XGETTEXTFILES)
-       $(XGETTEXT) --language=C --keyword=_ -o $@ $(XGETTEXTFILES)
+       $(XGETTEXT) --language=C --keyword=_ --keyword=N_ -o $@ $(XGETTEXTFILES)
 
 # Generate temp .po files, to check whether translations need updating.
 # Not by default, due to gettext output differences between versions.
diff --git a/xfsprogs/include/platform_defs.h.in 
b/xfsprogs/include/platform_defs.h.in
index 6682ef6..4f8ebe5 100644
--- a/xfsprogs/include/platform_defs.h.in
+++ b/xfsprogs/include/platform_defs.h.in
@@ -129,8 +129,10 @@ typedef unsigned long long __psunsigned_t;
 #ifdef ENABLE_GETTEXT
 # include <libintl.h>
 # define _(x)                   gettext(x)
+# define N_(x)                  x
 #else
 # define _(x)                   (x)
+# define N_(x)                  x
 # define textdomain(d)          do { } while (0)
 # define bindtextdomain(d,dir)  do { } while (0)
 #endif
diff --git a/xfsprogs/repair/progress.c b/xfsprogs/repair/progress.c
index 0ca9a8a..ff42f82 100644
--- a/xfsprogs/repair/progress.c
+++ b/xfsprogs/repair/progress.c
@@ -13,30 +13,30 @@
 static
 char *rpt_types[] = {
 #define TYPE_INODE     0
-       _("inodes"),
+       N_("inodes"),
 #define TYPE_BLOCK     1
-       _("blocks"),
+       N_("blocks"),
 #define TYPE_DIR       2
-       _("directories"),
+       N_("directories"),
 #define TYPE_AG                3
-       _("allocation groups"),
+       N_("allocation groups"),
 #define TYPE_AGI_BUCKET        4
-       _("AGI unlinked buckets"),
+       N_("AGI unlinked buckets"),
 #define TYPE_EXTENTS   5
-       _("extents"),
+       N_("extents"),
 #define TYPE_RTEXTENTS 6
-       _("realtime extents"),
+       N_("realtime extents"),
 #define TYPE_UNLINKED_LIST 7
-       _("unlinked lists")
+       N_("unlinked lists")
 };
 
 
 static
 char *rpt_fmts[] = {
 #define FMT1 0
-_("        - %02d:%02d:%02d: %s - %llu of %llu %s done\n"),
+N_("        - %02d:%02d:%02d: %s - %llu of %llu %s done\n"),
 #define FMT2 1
-_("        - %02d:%02d:%02d: %s - %llu %s done\n"),
+N_("        - %02d:%02d:%02d: %s - %llu %s done\n"),
 };
 
 typedef struct progress_rpt_s {
@@ -48,35 +48,35 @@ typedef struct progress_rpt_s {
 
 static
 progress_rpt_t progress_rpt_reports[] = {
-{FMT1, _("scanning filesystem freespace"),                     /*  0 */
+{FMT1, N_("scanning filesystem freespace"),                    /*  0 */
        &rpt_fmts[FMT1], &rpt_types[TYPE_AG]},
-{FMT1, _("scanning agi unlinked lists"),                       /*  1 */
+{FMT1, N_("scanning agi unlinked lists"),                      /*  1 */
        &rpt_fmts[FMT1], &rpt_types[TYPE_AG]},
-{FMT2, _("check uncertain AG inodes"),                         /*  2 */
+{FMT2, N_("check uncertain AG inodes"),                                /*  2 */
        &rpt_fmts[FMT2], &rpt_types[TYPE_AGI_BUCKET]},
-{FMT1, _("process known inodes and inode discovery"),          /*  3 */
+{FMT1, N_("process known inodes and inode discovery"),         /*  3 */
        &rpt_fmts[FMT1], &rpt_types[TYPE_INODE]},
-{FMT1, _("process newly discovered inodes"),                   /*  4 */
+{FMT1, N_("process newly discovered inodes"),                  /*  4 */
        &rpt_fmts[FMT1], &rpt_types[TYPE_AG]},
-{FMT1, _("setting up duplicate extent list"),                  /*  5 */
+{FMT1, N_("setting up duplicate extent list"),                 /*  5 */
        &rpt_fmts[FMT1], &rpt_types[TYPE_AG]},
-{FMT1, _("initialize realtime bitmap"),                                /*  6 */
+{FMT1, N_("initialize realtime bitmap"),                       /*  6 */
        &rpt_fmts[FMT1], &rpt_types[TYPE_BLOCK]},
-{FMT1, _("reset realtime bitmaps"),                            /*  7 */
+{FMT1, N_("reset realtime bitmaps"),                           /*  7 */
        &rpt_fmts[FMT1], &rpt_types[TYPE_AG]},
-{FMT1, _("check for inodes claiming duplicate blocks"),                /*  8 */
+{FMT1, N_("check for inodes claiming duplicate blocks"),       /*  8 */
        &rpt_fmts[FMT1], &rpt_types[TYPE_INODE]},
-{FMT1, _("rebuild AG headers and trees"),                      /*  9 */
+{FMT1, N_("rebuild AG headers and trees"),                     /*  9 */
        &rpt_fmts[FMT1], &rpt_types[TYPE_AG]},
-{FMT1, _("traversing filesystem"),                             /* 10 */
+{FMT1, N_("traversing filesystem"),                            /* 10 */
        &rpt_fmts[FMT1], &rpt_types[TYPE_AG]},
-{FMT2, _("traversing all unattached subtrees"),                        /* 11 */
+{FMT2, N_("traversing all unattached subtrees"),               /* 11 */
        &rpt_fmts[FMT2], &rpt_types[TYPE_DIR]},
-{FMT2, _("moving disconnected inodes to lost+found"),          /* 12 */
+{FMT2, N_("moving disconnected inodes to lost+found"),         /* 12 */
        &rpt_fmts[FMT2], &rpt_types[TYPE_INODE]},
-{FMT1, _("verify and correct link counts"),                    /* 13 */
+{FMT1, N_("verify and correct link counts"),                   /* 13 */
        &rpt_fmts[FMT1], &rpt_types[TYPE_INODE]},
-{FMT1, _("verify link counts"),                                        /* 14 */
+{FMT1, N_("verify link counts"),                               /* 14 */
        &rpt_fmts[FMT1], &rpt_types[TYPE_INODE]}
 };
 
-- 
1.6.0.5

<Prev in Thread] Current Thread [Next in Thread>