aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert1996-01-20 20:47:48 +0000
committerPaul Eggert1996-01-20 20:47:48 +0000
commitd28acb97e3e2de250373f61296ddd770bf29c128 (patch)
treeef706bbc55b55eaf4c51611e30b6042ebc33455d /src
parentc18381d187ef35fa274da3132759b1acbeef4f2c (diff)
downloademacs-d28acb97e3e2de250373f61296ddd770bf29c128.tar.gz
emacs-d28acb97e3e2de250373f61296ddd770bf29c128.zip
(Fformat_time_string): Don't crash if the resulting string is empty.
Doc fix.
Diffstat (limited to 'src')
-rw-r--r--src/editfns.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/editfns.c b/src/editfns.c
index 143bafdc687..bb9c4920ab7 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -612,12 +612,12 @@ FORMAT-STRING may contain %-sequences to substitute parts of the time.\n\
612%k is replaced by the hour (0-23), blank padded.\n\ 612%k is replaced by the hour (0-23), blank padded.\n\
613%l is replaced by the hour (1-12), blank padded.\n\ 613%l is replaced by the hour (1-12), blank padded.\n\
614%m is replaced by the month (01-12).\n\ 614%m is replaced by the month (01-12).\n\
615%M is replaced by the minut (00-59).\n\ 615%M is replaced by the minute (00-59).\n\
616%n is a synonym for \"\\n\".\n\ 616%n is a synonym for \"\\n\".\n\
617%p is replaced by AM or PM, as appropriate.\n\ 617%p is replaced by AM or PM, as appropriate.\n\
618%r is a synonym for \"%I:%M:%S %p\".\n\ 618%r is a synonym for \"%I:%M:%S %p\".\n\
619%R is a synonym for \"%H:%M\".\n\ 619%R is a synonym for \"%H:%M\".\n\
620%S is replaced by the seconds (00-60).\n\ 620%S is replaced by the second (00-60).\n\
621%t is a synonym for \"\\t\".\n\ 621%t is a synonym for \"\\t\".\n\
622%T is a synonym for \"%H:%M:%S\".\n\ 622%T is a synonym for \"%H:%M:%S\".\n\
623%U is replaced by the week of the year (01-52), first day of week is Sunday.\n\ 623%U is replaced by the week of the year (01-52), first day of week is Sunday.\n\
@@ -647,8 +647,10 @@ The number of options reflects the `strftime' function.")
647 while (1) 647 while (1)
648 { 648 {
649 char *buf = (char *) alloca (size); 649 char *buf = (char *) alloca (size);
650 *buf = 1;
650 if (emacs_strftime (buf, size, XSTRING (format_string)->data, 651 if (emacs_strftime (buf, size, XSTRING (format_string)->data,
651 localtime (&value))) 652 localtime (&value))
653 || !*buf)
652 return build_string (buf); 654 return build_string (buf);
653 /* If buffer was too small, make it bigger. */ 655 /* If buffer was too small, make it bigger. */
654 size *= 2; 656 size *= 2;