Mercurial > hg > octave-shane > gnulib-hg
comparison lib/argp-fmtstream.c @ 11562:d0742bd1f0f8
argp: avoid undefined behavior
* lib/argp-fmtstream.c (weak_alias): Pass correct types to ctype
macros.
Signed-off-by: Eric Blake <ebb9@byu.net>
author | Eric Blake <ebb9@byu.net> |
---|---|
date | Mon, 11 May 2009 05:54:20 -0600 |
parents | bbbbbf4cd1c5 |
children | e8d2c6fc33ad |
comparison
equal
deleted
inserted
replaced
11561:3485e4d3bbdb | 11562:d0742bd1f0f8 |
---|---|
224 | 224 |
225 char *p, *nextline; | 225 char *p, *nextline; |
226 int i; | 226 int i; |
227 | 227 |
228 p = buf + (r + 1 - fs->point_col); | 228 p = buf + (r + 1 - fs->point_col); |
229 while (p >= buf && !isblank (*p)) | 229 while (p >= buf && !isblank ((unsigned char) *p)) |
230 --p; | 230 --p; |
231 nextline = p + 1; /* This will begin the next line. */ | 231 nextline = p + 1; /* This will begin the next line. */ |
232 | 232 |
233 if (nextline > buf) | 233 if (nextline > buf) |
234 { | 234 { |
235 /* Swallow separating blanks. */ | 235 /* Swallow separating blanks. */ |
236 if (p >= buf) | 236 if (p >= buf) |
237 do | 237 do |
238 --p; | 238 --p; |
239 while (p >= buf && isblank (*p)); | 239 while (p >= buf && isblank ((unsigned char) *p)); |
240 nl = p + 1; /* The newline will replace the first blank. */ | 240 nl = p + 1; /* The newline will replace the first blank. */ |
241 } | 241 } |
242 else | 242 else |
243 { | 243 { |
244 /* A single word that is greater than the maximum line width. | 244 /* A single word that is greater than the maximum line width. |
246 p = buf + (r + 1 - fs->point_col); | 246 p = buf + (r + 1 - fs->point_col); |
247 /* Find the end of the long word. */ | 247 /* Find the end of the long word. */ |
248 if (p < nl) | 248 if (p < nl) |
249 do | 249 do |
250 ++p; | 250 ++p; |
251 while (p < nl && !isblank (*p)); | 251 while (p < nl && !isblank ((unsigned char) *p)); |
252 if (p == nl) | 252 if (p == nl) |
253 { | 253 { |
254 /* It already ends a line. No fussing required. */ | 254 /* It already ends a line. No fussing required. */ |
255 fs->point_col = 0; | 255 fs->point_col = 0; |
256 buf = nl + 1; | 256 buf = nl + 1; |
259 /* We will move the newline to replace the first blank. */ | 259 /* We will move the newline to replace the first blank. */ |
260 nl = p; | 260 nl = p; |
261 /* Swallow separating blanks. */ | 261 /* Swallow separating blanks. */ |
262 do | 262 do |
263 ++p; | 263 ++p; |
264 while (isblank (*p)); | 264 while (isblank ((unsigned char) *p)); |
265 /* The next line will start here. */ | 265 /* The next line will start here. */ |
266 nextline = p; | 266 nextline = p; |
267 } | 267 } |
268 | 268 |
269 /* Note: There are a bunch of tests below for | 269 /* Note: There are a bunch of tests below for |