]> code.delx.au - gnu-emacs/commitdiff
Sync from gnulib
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 13 May 2016 14:51:45 +0000 (07:51 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 13 May 2016 14:52:14 +0000 (07:52 -0700)
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
lib/mktime.c

index 00af87265b47cefa13e91fe62939f432f76ef499..9a232cc3a86169894d700f8e8b6070a705af9563 100644 (file)
@@ -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);
index 419a177c018bf73536cb0ccf1ef34d309abd93c0..40bc2a38a2160595e716da72951bf5d11267c8d7 100644 (file)
@@ -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 *),