[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master f791efc: Sync from gnulib
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] master f791efc: Sync from gnulib |
Date: |
Fri, 13 May 2016 14:52:24 +0000 (UTC) |
branch: master
commit f791efc057429c6370f02ab34e715ea2872f6cfa
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>
Sync from gnulib
This incorporates a spelling fix, plus:
2016-05-09 Fix undefined behaviour in gettext.h
* lib/gettext.h, lib/mktime.c:
Copy from gnulib.
---
lib/gettext.h | 8 ++++++--
lib/mktime.c | 2 +-
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/lib/gettext.h b/lib/gettext.h
index 00af872..9a232cc 100644
--- a/lib/gettext.h
+++ b/lib/gettext.h
@@ -225,15 +225,17 @@ dcpgettext_expr (const char *domain,
if (msg_ctxt_id != NULL)
#endif
{
+ int found_translation;
memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
msg_ctxt_id[msgctxt_len - 1] = '\004';
memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
translation = dcgettext (domain, msg_ctxt_id, category);
+ found_translation = (translation != msg_ctxt_id);
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
if (msg_ctxt_id != buf)
free (msg_ctxt_id);
#endif
- if (translation != msg_ctxt_id)
+ if (found_translation)
return translation;
}
return msgid;
@@ -271,15 +273,17 @@ dcnpgettext_expr (const char *domain,
if (msg_ctxt_id != NULL)
#endif
{
+ int found_translation;
memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
msg_ctxt_id[msgctxt_len - 1] = '\004';
memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n,
category);
+ found_translation = !(translation == msg_ctxt_id || translation ==
msgid_plural);
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
if (msg_ctxt_id != buf)
free (msg_ctxt_id);
#endif
- if (!(translation == msg_ctxt_id || translation == msgid_plural))
+ if (found_translation)
return translation;
}
return (n == 1 ? msgid : msgid_plural);
diff --git a/lib/mktime.c b/lib/mktime.c
index 419a177..40bc2a3 100644
--- a/lib/mktime.c
+++ b/lib/mktime.c
@@ -228,7 +228,7 @@ guess_time_tm (long_int year, long_int yday, int hour, int
min, int sec,
}
/* Use CONVERT to convert T to a struct tm value in *TM. T must be in
- range for time_t. Return TM if successfull, NULL if T is out of
+ range for time_t. Return TM if successful, NULL if T is out of
range for CONVERT. */
static struct tm *
convert_time (struct tm *(*convert) (const time_t *, struct tm *),
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master f791efc: Sync from gnulib,
Paul Eggert <=