Ignore:
Timestamp:
Jan 8, 2010, 1:48:21 AM (10 years ago)
Author:
Sam Hocevar
Message:

Fix compilation warning due to kfreebsd’s fcntl.h defining FREAD.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • zzuf/trunk/src/libzzuf/lib-stream.c

    r4232 r4238  
    3333/* Define the best ftell() clone */
    3434#if defined HAVE_FTELLO64
    35 #   define MYFTELL ftello64
     35#   define ZZ_FTELL ftello64
    3636#elif defined HAVE___FTELLO64
    37 #   define MYFTELL __ftello64
     37#   define ZZ_FTELL __ftello64
    3838#elif defined HAVE_FTELLO
    39 #   define MYFTELL ftello
     39#   define ZZ_FTELL ftello
    4040#else
    41 #   define MYFTELL ftell
     41#   define ZZ_FTELL ftell
    4242#endif
    4343
     
    233233 */
    234234
    235 #define FOPEN(myfopen) \
     235#define ZZ_FOPEN(myfopen) \
    236236    do \
    237237    { \
     
    252252    } while(0)
    253253
    254 #define FREOPEN(myfreopen) \
     254#define ZZ_FREOPEN(myfreopen) \
    255255    do \
    256256    { \
     
    279279FILE *NEW(fopen)(const char *path, const char *mode)
    280280{
    281     FILE *ret; FOPEN(fopen); return ret;
     281    FILE *ret; ZZ_FOPEN(fopen); return ret;
    282282}
    283283
     
    285285FILE *NEW(fopen64)(const char *path, const char *mode)
    286286{
    287     FILE *ret; FOPEN(fopen64); return ret;
     287    FILE *ret; ZZ_FOPEN(fopen64); return ret;
    288288}
    289289#endif
     
    292292FILE *NEW(__fopen64)(const char *path, const char *mode)
    293293{
    294     FILE *ret; FOPEN(__fopen64); return ret;
     294    FILE *ret; ZZ_FOPEN(__fopen64); return ret;
    295295}
    296296#endif
     
    298298FILE *NEW(freopen)(const char *path, const char *mode, FILE *stream)
    299299{
    300     FILE *ret; FREOPEN(freopen); return ret;
     300    FILE *ret; ZZ_FREOPEN(freopen); return ret;
    301301}
    302302
     
    304304FILE *NEW(freopen64)(const char *path, const char *mode, FILE *stream)
    305305{
    306     FILE *ret; FREOPEN(freopen64); return ret;
     306    FILE *ret; ZZ_FREOPEN(freopen64); return ret;
    307307}
    308308#endif
     
    311311FILE *NEW(__freopen64)(const char *path, const char *mode, FILE *stream)
    312312{
    313     FILE *ret; FREOPEN(__freopen64); return ret;
     313    FILE *ret; ZZ_FREOPEN(__freopen64); return ret;
    314314}
    315315#endif
     
    326326 */
    327327
    328 #define FSEEK(myfseek) \
     328#define ZZ_FSEEK(myfseek) \
    329329    do \
    330330    { \
     
    338338        debug_stream("before", stream); \
    339339        /* FIXME: ftell() will return -1 on a pipe such as stdin */ \
    340         oldpos = MYFTELL(stream); \
     340        oldpos = ZZ_FTELL(stream); \
    341341        oldoff = get_stream_off(stream); \
    342342        oldcnt = get_stream_cnt(stream); \
     
    344344        ret = ORIG(myfseek)(stream, offset, whence); \
    345345        _zz_unlock(fd); \
    346         newpos = MYFTELL(stream); \
     346        newpos = ZZ_FTELL(stream); \
    347347        if (newpos >= oldpos + oldcnt || newpos < oldpos - oldoff) \
    348348        { \
     
    357357    } while(0)
    358358
    359 #define FSETPOS(myfsetpos) \
     359#define ZZ_FSETPOS(myfsetpos) \
    360360    do \
    361361    { \
     
    369369        debug_stream("before", stream); \
    370370        /* FIXME: ftell() will return -1 on a pipe such as stdin */ \
    371         oldpos = MYFTELL(stream); \
     371        oldpos = ZZ_FTELL(stream); \
    372372        oldoff = get_stream_off(stream); \
    373373        oldcnt = get_stream_cnt(stream); \
     
    375375        ret = ORIG(myfsetpos)(stream, pos); \
    376376        _zz_unlock(fd); \
    377         newpos = MYFTELL(stream); \
     377        newpos = ZZ_FTELL(stream); \
    378378        if (newpos >= oldpos + oldcnt || newpos < oldpos - oldoff) \
    379379        { \
     
    389389    while(0)
    390390
    391 #define REWIND(myrewind) \
     391#define ZZ_REWIND(myrewind) \
    392392    do \
    393393    { \
     
    401401        debug_stream("before", stream); \
    402402        /* FIXME: ftell() will return -1 on a pipe such as stdin */ \
    403         oldpos = MYFTELL(stream); \
     403        oldpos = ZZ_FTELL(stream); \
    404404        oldoff = get_stream_off(stream); \
    405405        oldcnt = get_stream_cnt(stream); \
     
    407407        ORIG(rewind)(stream); \
    408408        _zz_unlock(fd); \
    409         newpos = MYFTELL(stream); \
     409        newpos = ZZ_FTELL(stream); \
    410410        if (newpos >= oldpos + oldcnt || newpos < oldpos - oldoff) \
    411411        { \
     
    421421int NEW(fseek)(FILE *stream, long offset, int whence)
    422422{
    423     int ret; FSEEK(fseek); return ret;
     423    int ret; ZZ_FSEEK(fseek); return ret;
    424424}
    425425
     
    427427int NEW(fseeko)(FILE *stream, off_t offset, int whence)
    428428{
    429     int ret; FSEEK(fseeko); return ret;
     429    int ret; ZZ_FSEEK(fseeko); return ret;
    430430}
    431431#endif
     
    434434int NEW(fseeko64)(FILE *stream, off64_t offset, int whence)
    435435{
    436     int ret; FSEEK(fseeko64); return ret;
     436    int ret; ZZ_FSEEK(fseeko64); return ret;
    437437}
    438438#endif
     
    441441int NEW(__fseeko64)(FILE *stream, off64_t offset, int whence)
    442442{
    443     int ret; FSEEK(__fseeko64); return ret;
     443    int ret; ZZ_FSEEK(__fseeko64); return ret;
    444444}
    445445#endif
     
    448448int NEW(fsetpos64)(FILE *stream, const fpos64_t *pos)
    449449{
    450     int ret; FSETPOS(fsetpos64); return ret;
     450    int ret; ZZ_FSETPOS(fsetpos64); return ret;
    451451}
    452452#endif
     
    455455int NEW(__fsetpos64)(FILE *stream, const fpos64_t *pos)
    456456{
    457     int ret; FSETPOS(__fsetpos64); return ret;
     457    int ret; ZZ_FSETPOS(__fsetpos64); return ret;
    458458}
    459459#endif
     
    461461void NEW(rewind)(FILE *stream)
    462462{
    463     REWIND(rewind);
     463    ZZ_REWIND(rewind);
    464464}
    465465
     
    473473 */
    474474
    475 #define FREAD(myfread) /* NEW */ \
     475#define ZZ_FREAD(myfread) /* NEW */ \
    476476    do \
    477477    { \
     
    486486        debug_stream("before", stream); \
    487487        /* FIXME: ftell() will return -1 on a pipe such as stdin */ \
    488         oldpos = MYFTELL(stream); \
     488        oldpos = ZZ_FTELL(stream); \
    489489        oldoff = get_stream_off(stream); \
    490490        oldcnt = get_stream_cnt(stream); \
     
    492492        ret = ORIG(myfread)(ptr, size, nmemb, stream); \
    493493        _zz_unlock(fd); \
    494         newpos = MYFTELL(stream); \
     494        newpos = ZZ_FTELL(stream); \
    495495        if (newpos >= oldpos + oldcnt) \
    496496        { \
     
    520520size_t NEW(fread)(void *ptr, size_t size, size_t nmemb, FILE *stream)
    521521{
    522     size_t ret; FREAD(fread); return ret;
     522    size_t ret; ZZ_FREAD(fread); return ret;
    523523}
    524524
     
    527527size_t NEW(fread_unlocked)(void *ptr, size_t size, size_t nmemb, FILE *stream)
    528528{
    529     size_t ret; FREAD(fread_unlocked); return ret;
     529    size_t ret; ZZ_FREAD(fread_unlocked); return ret;
    530530}
    531531#endif
     
    540540 */
    541541
    542 #define FGETC(myfgetc, s, arg) \
     542#define ZZ_FGETC(myfgetc, s, arg) \
    543543    do { \
    544544        int64_t oldpos, newpos; \
     
    550550            return ORIG(myfgetc)(arg); \
    551551        debug_stream("before", s); \
    552         oldpos = MYFTELL(s); \
     552        oldpos = ZZ_FTELL(s); \
    553553        oldoff = get_stream_off(s); \
    554554        oldcnt = get_stream_cnt(s); \
     
    556556        ret = ORIG(myfgetc)(arg); \
    557557        _zz_unlock(fd); \
    558         newpos = MYFTELL(s); \
     558        newpos = ZZ_FTELL(s); \
    559559        if (oldcnt == 0 && ret != EOF) \
    560560        { \
     
    583583int NEW(getc)(FILE *stream)
    584584{
    585     int ret; FGETC(getc, stream, stream); return ret;
     585    int ret; ZZ_FGETC(getc, stream, stream); return ret;
    586586}
    587587
     
    589589int NEW(getchar)(void)
    590590{
    591     int ret; FGETC(getchar, stdin, /* empty */); return ret;
     591    int ret; ZZ_FGETC(getchar, stdin, /* empty */); return ret;
    592592}
    593593
    594594int NEW(fgetc)(FILE *stream)
    595595{
    596     int ret; FGETC(fgetc, stream, stream); return ret;
     596    int ret; ZZ_FGETC(fgetc, stream, stream); return ret;
    597597}
    598598
     
    600600int NEW(_IO_getc)(FILE *stream)
    601601{
    602     int ret; FGETC(_IO_getc, stream, stream); return ret;
     602    int ret; ZZ_FGETC(_IO_getc, stream, stream); return ret;
    603603}
    604604#endif
     
    608608int NEW(getc_unlocked)(FILE *stream)
    609609{
    610     int ret; FGETC(getc_unlocked, stream, stream); return ret;
     610    int ret; ZZ_FGETC(getc_unlocked, stream, stream); return ret;
    611611}
    612612#endif
     
    616616int NEW(getchar_unlocked)(void)
    617617{
    618     int ret; FGETC(getchar_unlocked, stdin, /* empty */); return ret;
     618    int ret; ZZ_FGETC(getchar_unlocked, stdin, /* empty */); return ret;
    619619}
    620620#endif
     
    624624int NEW(fgetc_unlocked)(FILE *stream)
    625625{
    626     int ret; FGETC(fgetc_unlocked, stream, stream); return ret;
     626    int ret; ZZ_FGETC(fgetc_unlocked, stream, stream); return ret;
    627627}
    628628#endif
     
    632632 */
    633633
    634 #define FGETS(myfgets, myfgetc) \
     634#define ZZ_FGETS(myfgets, myfgetc) \
    635635    do \
    636636    { \
     
    645645            return ORIG(myfgets)(s, size, stream); \
    646646        debug_stream("before", stream); \
    647         oldpos = MYFTELL(stream); \
     647        oldpos = ZZ_FTELL(stream); \
    648648        oldoff = get_stream_off(stream); \
    649649        oldcnt = get_stream_cnt(stream); \
     
    703703char *NEW(fgets)(char *s, int size, FILE *stream)
    704704{
    705     char *ret; FGETS(fgets, fgetc); return ret;
     705    char *ret; ZZ_FGETS(fgets, fgetc); return ret;
    706706}
    707707
     
    709709char *NEW(fgets_unlocked)(char *s, int size, FILE *stream)
    710710{
    711     char *ret; FGETS(fgets_unlocked, fgetc_unlocked); return ret;
     711    char *ret; ZZ_FGETS(fgets_unlocked, fgetc_unlocked); return ret;
    712712}
    713713#endif
     
    727727
    728728    debug_stream("before", stream);
    729     oldpos = MYFTELL(stream);
     729    oldpos = ZZ_FTELL(stream);
    730730    _zz_lock(fd);
    731731    ret = ORIG(ungetc)(c, stream);
     
    768768 */
    769769
    770 #define GETDELIM(mygetdelim, delim, need_delim) \
     770#define ZZ_GETDELIM(mygetdelim, delim, need_delim) \
    771771    do { \
    772772        int64_t oldpos, newpos; \
     
    782782            return ORIG(getdelim)(lineptr, n, delim, stream); \
    783783        debug_stream("before", stream); \
    784         oldpos = MYFTELL(stream); \
     784        oldpos = ZZ_FTELL(stream); \
    785785        oldoff = get_stream_off(stream); \
    786786        oldcnt = get_stream_cnt(stream); \
     
    853853ssize_t NEW(getline)(char **lineptr, size_t *n, FILE *stream)
    854854{
    855     ssize_t ret; GETDELIM(getline, '\n', 0); return ret;
     855    ssize_t ret; ZZ_GETDELIM(getline, '\n', 0); return ret;
    856856}
    857857#endif
     
    860860ssize_t NEW(getdelim)(char **lineptr, size_t *n, int delim, FILE *stream)
    861861{
    862     ssize_t ret; GETDELIM(getdelim, delim, 1); return ret;
     862    ssize_t ret; ZZ_GETDELIM(getdelim, delim, 1); return ret;
    863863}
    864864#endif
     
    867867ssize_t NEW(__getdelim)(char **lineptr, size_t *n, int delim, FILE *stream)
    868868{
    869     ssize_t ret; GETDELIM(__getdelim, delim, 1); return ret;
     869    ssize_t ret; ZZ_GETDELIM(__getdelim, delim, 1); return ret;
    870870}
    871871#endif
     
    891891
    892892    debug_stream("before", stream);
    893     oldpos = MYFTELL(stream);
     893    oldpos = ZZ_FTELL(stream);
    894894    oldoff = get_stream_off(stream);
    895895    oldcnt = get_stream_cnt(stream);
     
    957957#endif
    958958
    959 #define REFILL(myrefill, fn_advances) \
     959#define ZZ_REFILL(myrefill, fn_advances) \
    960960    do \
    961961    { \
     
    10151015int NEW(__srefill)(FILE *fp)
    10161016{
    1017     int ret; REFILL(__srefill, 0); return ret;
     1017    int ret; ZZ_REFILL(__srefill, 0); return ret;
    10181018}
    10191019#endif
     
    10221022int NEW(__srget)(FILE *fp)
    10231023{
    1024     int ret; REFILL(__srget, 1); return ret;
     1024    int ret; ZZ_REFILL(__srget, 1); return ret;
    10251025}
    10261026#endif
     
    10291029int NEW(__filbuf)(FILE *fp)
    10301030{
    1031     int ret; REFILL(__filbuf, 1); return ret;
     1031    int ret; ZZ_REFILL(__filbuf, 1); return ret;
    10321032}
    10331033#endif
     
    10361036int NEW(__uflow)(FILE *fp)
    10371037{
    1038     int ret; REFILL(__uflow, 1); return ret;
    1039 }
    1040 #endif
    1041 
     1038    int ret; ZZ_REFILL(__uflow, 1); return ret;
     1039}
     1040#endif
     1041
Note: See TracChangeset for help on using the changeset viewer.