Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
lscsoft
metaio
Commits
5c62ed4b
Commit
5c62ed4b
authored
Dec 10, 2013
by
Kipp Cannon
Browse files
clean up metaio.c now that zlib is no longer optional
parent
6443e087
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/metaio.c
View file @
5c62ed4b
...
...
@@ -43,6 +43,7 @@
#include
<stdlib.h>
#include
<stdarg.h>
#include
<ctype.h>
#include
<zlib.h>
#include
"config.h"
#include
"metaio.h"
...
...
@@ -57,13 +58,6 @@
#define DEBUGMSG2(s,d)
#endif
/* DEBUG */
#ifdef HAVE_LIBZ
#include
<zlib.h>
#define gzclose(fp) gzclose((gzFile)(fp))
#define gzgetc(fp) gzgetc((gzFile)(fp))
#define gzungetc(c,fp) gzungetc(c,(gzFile)(fp))
/*
* Warning: This is not a fully implemented scanf routine!
* Warning: Only a single conversion to a numeric type is supported!
...
...
@@ -155,38 +149,6 @@ static int geterrno( gzFile file, const char **msg )
return
errnum
;
}
#else
/* HAVE_LIBZ */
#define gzopen(path,mode) fopen(path,mode)
#define gzclose(fp) fclose(fp)
#define gzgetc(fp) fgetc(fp)
#define gzungetc(c,fp) ungetc(c,fp)
#define gzscanf fscanf
static
int
geterrno
(
FILE
*
file
,
const
char
**
msg
)
{
int
errnum
;
if
(
ferror
(
file
))
{
/* there was an error, use errno and retrieve appropriate message */
*
msg
=
strerror
(
errno
);
errnum
=
errno
;
}
else
{
/* no error */
*
msg
=
NULL
;
if
(
feof
(
file
))
/* EOF probably doesn't overlap with any errno constants */
errnum
=
EOF
;
else
errnum
=
0
;
}
return
errnum
;
}
#endif
/* HAVE_LIBZ */
enum
Token
{
CLOSE_COLUMN
,
...
...
@@ -597,7 +559,7 @@ int destroy_parse_env(MetaioParseEnv const env)
{
if
(
env
->
file
->
mode
==
'r'
)
{
ret
=
gzclose
(
env
->
file
->
fp
);
ret
=
gzclose
(
(
gzFile
)
env
->
file
->
fp
);
if
(
ret
==
-
3
)
/* XXX hack put in due to bug in zlib 1.2.2 XXX */
/* XXX this is not necessary in 1.2.3 and should XXX */
...
...
@@ -671,7 +633,7 @@ int character_entity(const char* const s)
static
int
get_char
(
MetaioParseEnv
env
)
{
int
c
=
gzgetc
(
env
->
file
->
fp
);
int
c
=
gzgetc
(
(
gzFile
)
env
->
file
->
fp
);
if
(
c
<
0
)
{
...
...
@@ -709,7 +671,7 @@ int unget_char(MetaioParseEnv env, int c)
if
(
c
==
'\n'
)
env
->
file
->
lineno
--
;
return
gzungetc
(
c
,
env
->
file
->
fp
);
return
gzungetc
(
c
,
(
gzFile
)
env
->
file
->
fp
);
}
/*
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment