[PATCH] libebl: consistently use _(Str) instead of gettext(Str)

Dmitry V. Levin ldv@altlinux.org
Wed Dec 16 01:48:00 GMT 2020


libeblP.h defines _(Str) to dgettext ("elfutils", Str) instead of
a simple gettext (Str) for a reason: the library might be indirectly
used by clients that called bindtextdomain with a domain different
from "elfutils".

The change was made automatically using the following command:
$ git grep -l '\<gettext *(' libebl |xargs sed -i 's/\<gettext *(/_(/g'

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
 libebl/ChangeLog              | 14 ++++++++++++++
 libebl/eblbackendname.c       |  2 +-
 libebl/eblcorenotetypename.c  |  2 +-
 libebl/ebldynamictagname.c    |  2 +-
 libebl/eblobjnote.c           | 22 +++++++++++-----------
 libebl/eblobjnotetypename.c   |  6 +++---
 libebl/eblosabiname.c         |  4 ++--
 libebl/eblsectionname.c       |  2 +-
 libebl/eblsectiontypename.c   |  2 +-
 libebl/eblsegmenttypename.c   |  2 +-
 libebl/eblsymbolbindingname.c |  2 +-
 libebl/eblsymboltypename.c    |  2 +-
 12 files changed, 38 insertions(+), 24 deletions(-)

diff --git a/libebl/ChangeLog b/libebl/ChangeLog
index 04e9cd49..e0862ec3 100644
--- a/libebl/ChangeLog
+++ b/libebl/ChangeLog
@@ -1,3 +1,17 @@
+2020-12-15  Dmitry V. Levin  <ldv@altlinux.org>
+
+	* eblbackendname.c (ebl_backend_name): Replace gettext(...) with _(...).
+	* eblcorenotetypename.c (ebl_core_note_type_name): Likewise.
+	* ebldynamictagname.c (ebl_dynamic_tag_name): Likewise.
+	* eblobjnote.c (ebl_object_note): Likewise.
+	* eblobjnotetypename.c (ebl_object_note_type_name): Likewise.
+	* eblosabiname.c (ebl_osabi_name): Likewise.
+	* eblsectionname.c (ebl_section_name): Likewise.
+	* eblsectiontypename.c (ebl_section_type_name): Likewise.
+	* eblsegmenttypename.c (ebl_segment_type_name): Likewise.
+	* eblsymbolbindingname.c (ebl_symbol_binding_name): Likewise.
+	* eblsymboltypename.c (ebl_symbol_type_name): Likewise.
+
 2020-10-19  Mark Wielaard  <mark@klomp.org>
 
 	* eblopenbackend.c (tilegx_init): Removed.
diff --git a/libebl/eblbackendname.c b/libebl/eblbackendname.c
index a2b2df69..e52b1e84 100644
--- a/libebl/eblbackendname.c
+++ b/libebl/eblbackendname.c
@@ -38,5 +38,5 @@
 const char *
 ebl_backend_name (Ebl *ebl)
 {
-  return ebl != NULL ? ebl->emulation : gettext ("No backend");
+  return ebl != NULL ? ebl->emulation : _("No backend");
 }
diff --git a/libebl/eblcorenotetypename.c b/libebl/eblcorenotetypename.c
index d3a56fa9..0e790d06 100644
--- a/libebl/eblcorenotetypename.c
+++ b/libebl/eblcorenotetypename.c
@@ -97,7 +97,7 @@ ebl_core_note_type_name (Ebl *ebl, uint32_t type, char *buf, size_t len)
 #undef KNOWNSTYPE
 
 	  default:
-	    snprintf (buf, len, "%s: %" PRIu32, gettext ("<unknown>"), type);
+	    snprintf (buf, len, "%s: %" PRIu32, _("<unknown>"), type);
 
 	    res = buf;
 	  }
diff --git a/libebl/ebldynamictagname.c b/libebl/ebldynamictagname.c
index 5622fc31..3f8d8ee4 100644
--- a/libebl/ebldynamictagname.c
+++ b/libebl/ebldynamictagname.c
@@ -100,7 +100,7 @@ ebl_dynamic_tag_name (Ebl *ebl, int64_t tag, char *buf, size_t len)
 	res = "FILTER";
       else
 	{
-	  snprintf (buf, len, gettext ("<unknown>: %#" PRIx64), tag);
+	  snprintf (buf, len, _("<unknown>: %#" PRIx64), tag);
 
 	  res = buf;
 
diff --git a/libebl/eblobjnote.c b/libebl/eblobjnote.c
index 37cbc499..36efe275 100644
--- a/libebl/eblobjnote.c
+++ b/libebl/eblobjnote.c
@@ -55,7 +55,7 @@ ebl_object_note (Ebl *ebl, uint32_t namesz, const char *name, uint32_t type,
 	{
 	  if (type != 3)
 	    {
-	      printf (gettext ("unknown SDT version %u\n"), type);
+	      printf (_("unknown SDT version %u\n"), type);
 	      return;
 	    }
 
@@ -73,7 +73,7 @@ ebl_object_note (Ebl *ebl, uint32_t namesz, const char *name, uint32_t type,
 	  if (descsz < addrs_size + 3)
 	    {
 	    invalid_sdt:
-	      printf (gettext ("invalid SDT probe descriptor\n"));
+	      printf (_("invalid SDT probe descriptor\n"));
 	      return;
 	    }
 
@@ -123,17 +123,17 @@ ebl_object_note (Ebl *ebl, uint32_t namesz, const char *name, uint32_t type,
 	      sem = addrs.a64[2];
 	    }
 
-	  printf (gettext ("    PC: "));
+	  printf (_("    PC: "));
 	  printf ("%#" PRIx64 ",", pc);
-	  printf (gettext (" Base: "));
+	  printf (_(" Base: "));
 	  printf ("%#" PRIx64 ",", base);
-	  printf (gettext (" Semaphore: "));
+	  printf (_(" Semaphore: "));
 	  printf ("%#" PRIx64 "\n", sem);
-	  printf (gettext ("    Provider: "));
+	  printf (_("    Provider: "));
 	  printf ("%s,", provider);
-	  printf (gettext (" Name: "));
+	  printf (_(" Name: "));
 	  printf ("%s,", pname);
-	  printf (gettext (" Args: "));
+	  printf (_(" Args: "));
 	  printf ("'%s'\n", args);
 	  return;
 	}
@@ -297,7 +297,7 @@ ebl_object_note (Ebl *ebl, uint32_t namesz, const char *name, uint32_t type,
 	case NT_GNU_BUILD_ID:
 	  if (strcmp (name, "GNU") == 0 && descsz > 0)
 	    {
-	      printf (gettext ("    Build ID: "));
+	      printf (_("    Build ID: "));
 	      uint_fast32_t i;
 	      for (i = 0; i < descsz - 1; ++i)
 		printf ("%02" PRIx8, (uint8_t) desc[i]);
@@ -308,7 +308,7 @@ ebl_object_note (Ebl *ebl, uint32_t namesz, const char *name, uint32_t type,
 	case NT_GNU_GOLD_VERSION:
 	  if (strcmp (name, "GNU") == 0 && descsz > 0)
 	    /* A non-null terminated version string.  */
-	    printf (gettext ("    Linker version: %.*s\n"),
+	    printf (_("    Linker version: %.*s\n"),
 		    (int) descsz, desc);
 	  break;
 
@@ -635,7 +635,7 @@ ebl_object_note (Ebl *ebl, uint32_t namesz, const char *name, uint32_t type,
 		      break;
 		    }
 
-		  printf (gettext ("    OS: %s, ABI: "), os);
+		  printf (_("    OS: %s, ABI: "), os);
 		  for (size_t cnt = 1; cnt < descsz / 4; ++cnt)
 		    {
 		      if (cnt > 1)
diff --git a/libebl/eblobjnotetypename.c b/libebl/eblobjnotetypename.c
index 6b803cef..9daddcda 100644
--- a/libebl/eblobjnotetypename.c
+++ b/libebl/eblobjnotetypename.c
@@ -74,7 +74,7 @@ ebl_object_note_type_name (Ebl *ebl, const char *name, uint32_t type,
 	    return goknowntypes[type];
 	  else
 	    {
-	      snprintf (buf, len, "%s: %" PRIu32, gettext ("<unknown>"), type);
+	      snprintf (buf, len, "%s: %" PRIu32, _("<unknown>"), type);
 	      return buf;
 	    }
 	}
@@ -106,7 +106,7 @@ ebl_object_note_type_name (Ebl *ebl, const char *name, uint32_t type,
 	  if (descsz == 0 && type == NT_VERSION)
 	    return "VERSION";
 
-	  snprintf (buf, len, "%s: %" PRIu32, gettext ("<unknown>"), type);
+	  snprintf (buf, len, "%s: %" PRIu32, _("<unknown>"), type);
 	  return buf;
 	}
 
@@ -127,7 +127,7 @@ ebl_object_note_type_name (Ebl *ebl, const char *name, uint32_t type,
 	res = knowntypes[type];
       else
 	{
-	  snprintf (buf, len, "%s: %" PRIu32, gettext ("<unknown>"), type);
+	  snprintf (buf, len, "%s: %" PRIu32, _("<unknown>"), type);
 
 	  res = buf;
 	}
diff --git a/libebl/eblosabiname.c b/libebl/eblosabiname.c
index b60f2af4..48b3c051 100644
--- a/libebl/eblosabiname.c
+++ b/libebl/eblosabiname.c
@@ -67,10 +67,10 @@ ebl_osabi_name (Ebl *ebl, int osabi, char *buf, size_t len)
       else if (osabi == ELFOSABI_ARM)
 	res = "Arm";
       else if (osabi == ELFOSABI_STANDALONE)
-	res = gettext ("Stand alone");
+	res = _("Stand alone");
       else
 	{
-	  snprintf (buf, len, "%s: %d", gettext ("<unknown>"), osabi);
+	  snprintf (buf, len, "%s: %d", _("<unknown>"), osabi);
 
 	  res = buf;
 	}
diff --git a/libebl/eblsectionname.c b/libebl/eblsectionname.c
index 21c537ff..825ad2f8 100644
--- a/libebl/eblsectionname.c
+++ b/libebl/eblsectionname.c
@@ -80,7 +80,7 @@ ebl_section_name (Ebl *ebl, int section, int xsection, char *buf, size_t len,
 	  else if (section >= SHN_LORESERVE && section <= SHN_HIRESERVE)
 	    snprintf (buf, len, "LORESERVE+%x", section - SHN_LORESERVE);
 	  else
-	    snprintf (buf, len, "%s: %d", gettext ("<unknown>"), section);
+	    snprintf (buf, len, "%s: %d", _("<unknown>"), section);
 
 	  res = buf;
 	}
diff --git a/libebl/eblsectiontypename.c b/libebl/eblsectiontypename.c
index 5dc1ec6d..2008b95a 100644
--- a/libebl/eblsectiontypename.c
+++ b/libebl/eblsectiontypename.c
@@ -112,7 +112,7 @@ ebl_section_type_name (Ebl *ebl, int section, char *buf, size_t len)
 		     && (unsigned int) section <= SHT_HIUSER)
 	      snprintf (buf, len, "SHT_LOUSER+%x", section - SHT_LOUSER);
 	    else
-	      snprintf (buf, len, "%s: %d", gettext ("<unknown>"), section);
+	      snprintf (buf, len, "%s: %d", _("<unknown>"), section);
 
 	    res = buf;
 	    break;
diff --git a/libebl/eblsegmenttypename.c b/libebl/eblsegmenttypename.c
index 23a85482..99779214 100644
--- a/libebl/eblsegmenttypename.c
+++ b/libebl/eblsegmenttypename.c
@@ -78,7 +78,7 @@ ebl_segment_type_name (Ebl *ebl, int segment, char *buf, size_t len)
 	  else if (segment >= PT_LOPROC && segment <= PT_HIPROC)
 	    snprintf (buf, len, "LOPROC+%d", segment - PT_LOPROC);
 	  else
-	    snprintf (buf, len, "%s: %d", gettext ("<unknown>"), segment);
+	    snprintf (buf, len, "%s: %d", _("<unknown>"), segment);
 
 	  res = buf;
 	}
diff --git a/libebl/eblsymbolbindingname.c b/libebl/eblsymbolbindingname.c
index 75565fe8..ebd8c2e3 100644
--- a/libebl/eblsymbolbindingname.c
+++ b/libebl/eblsymbolbindingname.c
@@ -65,7 +65,7 @@ ebl_symbol_binding_name (Ebl *ebl, int binding, char *buf, size_t len)
 	  else if (binding >= STB_LOOS && binding <= STB_HIOS)
 	    snprintf (buf, len, "LOOS+%d", binding - STB_LOOS);
 	  else
-	    snprintf (buf, len, gettext ("<unknown>: %d"), binding);
+	    snprintf (buf, len, _("<unknown>: %d"), binding);
 
 	  res = buf;
 	}
diff --git a/libebl/eblsymboltypename.c b/libebl/eblsymboltypename.c
index 53b145a8..0ff1722a 100644
--- a/libebl/eblsymboltypename.c
+++ b/libebl/eblsymboltypename.c
@@ -71,7 +71,7 @@ ebl_symbol_type_name (Ebl *ebl, int symbol, char *buf, size_t len)
 	  else if (symbol >= STT_LOOS && symbol <= STT_HIOS)
 	    snprintf (buf, len, "LOOS+%d", symbol - STT_LOOS);
 	  else
-	    snprintf (buf, len, gettext ("<unknown>: %d"), symbol);
+	    snprintf (buf, len, _("<unknown>: %d"), symbol);
 
 	  res = buf;
 	}
-- 
ldv


More information about the Elfutils-devel mailing list