Changeset 2334 for zzuf/trunk/src
- Timestamp:
- May 18, 2008, 2:38:32 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
zzuf/trunk/src/lib-stream.c
r2332 r2334 63 63 #endif 64 64 static int (*ORIG(getc)) (FILE *stream); 65 static int (*ORIG(getchar)) (void); 65 66 static int (*ORIG(fgetc)) (FILE *stream); 66 67 #if defined HAVE__IO_GETC … … 68 69 #endif 69 70 #if defined HAVE_GETC_UNLOCKED 70 static int (*ORIG(getc_unlocked)) (FILE *stream); 71 static int (*ORIG(getc_unlocked)) (FILE *stream); 72 #endif 73 #if defined HAVE_GETCHAR_UNLOCKED 74 static int (*ORIG(getchar_unlocked)) (void); 71 75 #endif 72 76 #if defined HAVE_FGETC_UNLOCKED 73 static int (*ORIG(fgetc_unlocked)) (FILE *stream);77 static int (*ORIG(fgetc_unlocked)) (FILE *stream); 74 78 #endif 75 79 static char * (*ORIG(fgets)) (char *s, int size, FILE *stream); 76 80 #if defined HAVE_FGETS_UNLOCKED 77 static char * (*ORIG(fgets_unlocked)) (char *s, int size, FILE *stream);81 static char * (*ORIG(fgets_unlocked)) (char *s, int size, FILE *stream); 78 82 #endif 79 83 static int (*ORIG(ungetc)) (int c, FILE *stream); … … 318 322 #endif 319 323 320 #define FGETC(fn ) \324 #define FGETC(fn, s, arg) \ 321 325 do { \ 322 326 int fd; \ 323 327 LOADSYM(fn); \ 324 fd = fileno(s tream); \328 fd = fileno(s); \ 325 329 if(!_zz_ready || !_zz_iswatched(fd) || !_zz_isactive(fd)) \ 326 return ORIG(fn)( stream); \330 return ORIG(fn)(arg); \ 327 331 _zz_lock(fd); \ 328 ret = ORIG(fn)( stream); \332 ret = ORIG(fn)(arg); \ 329 333 _zz_unlock(fd); \ 330 334 FGETC_FUZZ \ … … 338 342 int NEW(getc)(FILE *stream) 339 343 { 340 int ret; FGETC(getc); return ret; 344 int ret; FGETC(getc, stream, stream); return ret; 345 } 346 347 #undef getchar /* can be a macro; we don’t want that */ 348 int NEW(getchar)(void) 349 { 350 int ret; FGETC(getchar, stdin, /* empty */); return ret; 341 351 } 342 352 343 353 int NEW(fgetc)(FILE *stream) 344 354 { 345 int ret; FGETC(fgetc ); return ret;355 int ret; FGETC(fgetc, stream, stream); return ret; 346 356 } 347 357 … … 349 359 int NEW(_IO_getc)(FILE *stream) 350 360 { 351 int ret; FGETC(_IO_getc ); return ret;361 int ret; FGETC(_IO_getc, stream, stream); return ret; 352 362 } 353 363 #endif … … 357 367 int NEW(getc_unlocked)(FILE *stream) 358 368 { 359 int ret; FGETC(getc_unlocked); return ret; 369 int ret; FGETC(getc_unlocked, stream, stream); return ret; 370 } 371 #endif 372 373 #if defined HAVE_GETCHAR_UNLOCKED 374 #undef getchar_unlocked /* can be a macro; we don’t want that */ 375 int NEW(getchar_unlocked)(void) 376 { 377 int ret; FGETC(getchar_unlocked, stdin, /* empty */); return ret; 360 378 } 361 379 #endif … … 365 383 int NEW(fgetc_unlocked)(FILE *stream) 366 384 { 367 int ret; FGETC(fgetc_unlocked ); return ret;385 int ret; FGETC(fgetc_unlocked, stream, stream); return ret; 368 386 } 369 387 #endif
Note: See TracChangeset
for help on using the changeset viewer.