summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2019-01-08 21:15:18 +0200
committerArnold D. Robbins <arnold@skeeve.com>2019-01-08 21:15:18 +0200
commit212e063404fa8bf876f9412318f4677cfd6f93db (patch)
treee07c256fda52992b80ddf6eaa253832764c85418
parentf8f8129b0cf19bd3a001d9421c35aa3dd818d6d8 (diff)
downloadgawk-212e063404fa8bf876f9412318f4677cfd6f93db.tar.gz
Small optimization for translatable strings.
-rwxr-xr-xChangeLog6
-rw-r--r--interpret.h5
2 files changed, 10 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 54728603..fc4eec58 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2019-01-08 Arnold D. Robbins <arnold@skeeve.com>
+
+ * interpret.h (r_interpret): For a translatable string, only copy
+ the gettext return value if it's different from the original.
+ Otherwise, use the original.
+
2018-12-21 Arnold D. Robbins <arnold@skeeve.com>
* configure.ac: Remove -O only if .developing has 'debug' in it.
diff --git a/interpret.h b/interpret.h
index 4381a929..2934c5c0 100644
--- a/interpret.h
+++ b/interpret.h
@@ -156,7 +156,10 @@ top:
orig = m->stptr;
trans = dgettext(TEXTDOMAIN, orig);
m->stptr[m->stlen] = save;
- m = make_string(trans, strlen(trans));
+ if (trans != orig) // got a translation
+ m = make_string(trans, strlen(trans));
+ else
+ UPREF(m);
} else
UPREF(m);
PUSH(m);