source: lib/common.h @ d56089a

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since d56089a was f66a4933, checked in by Daniel Lawson <dlawson@…>, 16 years ago

moved LIBTRACE_READ etc defines into common.h

if we don't have zlib, use read,open etc. We were using fread,fopen, but these take different parameters, and i couldn't make them work nicely.

stdin doesn't seem to work for non-zlib paths however

  • Property mode set to 100644
File size: 807 bytes
RevLine 
[6ad8afc]1#ifndef COMMON_H
2#define COMMON_H 1
3
4#ifdef __cplusplus
5#  define BEGIN_C_DECLS extern "C" {
6#  define END_C_DECLS   }
7#else /* !__cplusplus */
8#  define BEGIN_C_DECLS
9#  define END_C_DECLS
10#endif /* __cplusplus */
11
[f66a4933]12#if HAVE_ZLIB
13#  include <zlib.h>
14#  define LIBTRACE_READ(file,buf,len) gzread(file,buf,len)
15#  define LIBTRACE_FDOPEN(fd,mode) gzdopen(fd,mode)
16#  define LIBTRACE_OPEN(path,mode) gzopen(path,mode)
17#  define LIBTRACE_CLOSE(file) gzclose(file)
18#  define LIBTRACE_WRITE(file,buf,len) gzwrite(file,buf,len)
19#else
20#  define LIBTRACE_READ(file,buf,len) read(file,buf,len)
21#  define LIBTRACE_FDOPEN(fd,mode) dup(fd)
22#  define LIBTRACE_OPEN(path,mode) open(path,mode)
23#  define LIBTRACE_CLOSE(file) close(file)
24#  define LIBTRACE_WRITE(file,buf,len) write(file,buf,len)
25#endif
26
[6ad8afc]27#endif // COMMON_H
Note: See TracBrowser for help on using the repository browser.