aboutsummaryrefslogtreecommitdiffstats
path: root/src/strftime.c
diff options
context:
space:
mode:
authorPaul Eggert1997-05-27 03:15:29 +0000
committerPaul Eggert1997-05-27 03:15:29 +0000
commit098401cfa2769a1be43535cbb401cfff2de036b5 (patch)
treec4e2dc98cb284023c2adef7ea0b1fb0b5d7aa9dc /src/strftime.c
parent1aa6072f7d8439d34950925c51c21e0cb1625279 (diff)
downloademacs-098401cfa2769a1be43535cbb401cfff2de036b5.tar.gz
emacs-098401cfa2769a1be43535cbb401cfff2de036b5.zip
automatically generated from GPLed version
Diffstat (limited to 'src/strftime.c')
-rw-r--r--src/strftime.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/strftime.c b/src/strftime.c
index c0cc077b072..abd039f5b24 100644
--- a/src/strftime.c
+++ b/src/strftime.c
@@ -177,6 +177,7 @@ localtime_r (t, tp)
177/* Some systems lack the `memset' function and we don't want to 177/* Some systems lack the `memset' function and we don't want to
178 introduce additional dependencies. */ 178 introduce additional dependencies. */
179static const char spaces[16] = " "; 179static const char spaces[16] = " ";
180static const char zeroes[16] = "0000000000000000";
180 181
181# define memset_space(P, Len) \ 182# define memset_space(P, Len) \
182 do { \ 183 do { \
@@ -191,11 +192,26 @@ static const char spaces[16] = " ";
191 } \ 192 } \
192 while (_len > 0); \ 193 while (_len > 0); \
193 } while (0) 194 } while (0)
195
196# define memset_zero(P, Len) \
197 do { \
198 int _len = (Len); \
199 \
200 do \
201 { \
202 int _this = _len > 16 ? 16 : _len; \
203 memcpy ((P), zeroes, _this); \
204 (P) += _this; \
205 _len -= _this; \
206 } \
207 while (_len > 0); \
208 } while (0)
194#else 209#else
195# define memset_space(P, Len) (memset ((P), ' ', (Len)), (P) += (Len)) 210# define memset_space(P, Len) (memset ((P), ' ', (Len)), (P) += (Len))
211# define memset_zero(P, Len) (memset ((P), '0', (Len)), (P) += (Len))
196#endif 212#endif
197 213
198#define add(n, f) \ 214#define add(n, f) \
199 do \ 215 do \
200 { \ 216 { \
201 int _n = (n); \ 217 int _n = (n); \
@@ -206,7 +222,12 @@ static const char spaces[16] = " ";
206 if (p) \ 222 if (p) \
207 { \ 223 { \
208 if (_delta > 0) \ 224 if (_delta > 0) \
209 memset_space (p, _delta); \ 225 { \
226 if (pad == '0') \
227 memset_zero (p, _delta); \
228 else \
229 memset_space (p, _delta); \
230 } \
210 f; \ 231 f; \
211 p += _n; \ 232 p += _n; \
212 } \ 233 } \