Properly warp around more code under COMPILE_ONLY to recover from build
errors.
This commit is contained in:
parent
de1070d4d8
commit
91e3f06a9e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=210761
@ -99,14 +99,18 @@ private size_t apprentice_magic_strength(const struct magic *);
|
|||||||
private int apprentice_sort(const void *, const void *);
|
private int apprentice_sort(const void *, const void *);
|
||||||
private int apprentice_load(struct magic_set *, struct magic **, uint32_t *,
|
private int apprentice_load(struct magic_set *, struct magic **, uint32_t *,
|
||||||
const char *, int);
|
const char *, int);
|
||||||
|
#ifndef COMPILE_ONLY
|
||||||
private void byteswap(struct magic *, uint32_t);
|
private void byteswap(struct magic *, uint32_t);
|
||||||
private void bs1(struct magic *);
|
private void bs1(struct magic *);
|
||||||
private uint16_t swap2(uint16_t);
|
private uint16_t swap2(uint16_t);
|
||||||
private uint32_t swap4(uint32_t);
|
private uint32_t swap4(uint32_t);
|
||||||
private uint64_t swap8(uint64_t);
|
private uint64_t swap8(uint64_t);
|
||||||
|
#endif
|
||||||
private char *mkdbname(struct magic_set *, const char *, int);
|
private char *mkdbname(struct magic_set *, const char *, int);
|
||||||
|
#ifndef COMPILE_ONLY
|
||||||
private int apprentice_map(struct magic_set *, struct magic **, uint32_t *,
|
private int apprentice_map(struct magic_set *, struct magic **, uint32_t *,
|
||||||
const char *);
|
const char *);
|
||||||
|
#endif
|
||||||
private int apprentice_compile(struct magic_set *, struct magic **, uint32_t *,
|
private int apprentice_compile(struct magic_set *, struct magic **, uint32_t *,
|
||||||
const char *);
|
const char *);
|
||||||
private int check_format_type(const char *, int);
|
private int check_format_type(const char *, int);
|
||||||
@ -263,9 +267,13 @@ apprentice_1(struct magic_set *ms, const char *fn, int action,
|
|||||||
{
|
{
|
||||||
struct magic *magic = NULL;
|
struct magic *magic = NULL;
|
||||||
uint32_t nmagic = 0;
|
uint32_t nmagic = 0;
|
||||||
|
#ifndef COMPILE_ONLY
|
||||||
struct mlist *ml;
|
struct mlist *ml;
|
||||||
|
#endif
|
||||||
int rv = -1;
|
int rv = -1;
|
||||||
|
#ifndef COMPILE_ONLY
|
||||||
int mapped;
|
int mapped;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (magicsize != FILE_MAGICSIZE) {
|
if (magicsize != FILE_MAGICSIZE) {
|
||||||
file_error(ms, 0, "magic element size %lu != %lu",
|
file_error(ms, 0, "magic element size %lu != %lu",
|
||||||
@ -314,8 +322,8 @@ apprentice_1(struct magic_set *ms, const char *fn, int action,
|
|||||||
ml->next = mlist;
|
ml->next = mlist;
|
||||||
mlist->prev = ml;
|
mlist->prev = ml;
|
||||||
|
|
||||||
return 0;
|
|
||||||
#endif /* COMPILE_ONLY */
|
#endif /* COMPILE_ONLY */
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void
|
protected void
|
||||||
@ -2053,6 +2061,7 @@ eatsize(const char **p)
|
|||||||
*p = l;
|
*p = l;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef COMPILE_ONLY
|
||||||
/*
|
/*
|
||||||
* handle a compiled file.
|
* handle a compiled file.
|
||||||
*/
|
*/
|
||||||
@ -2150,6 +2159,7 @@ apprentice_map(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp,
|
|||||||
free(dbname);
|
free(dbname);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
#endif /* COMPILE_ONLY */
|
||||||
|
|
||||||
private const uint32_t ar[] = {
|
private const uint32_t ar[] = {
|
||||||
MAGICNO, VERSIONNO
|
MAGICNO, VERSIONNO
|
||||||
@ -2244,6 +2254,7 @@ mkdbname(struct magic_set *ms, const char *fn, int strip)
|
|||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef COMPILE_ONLY
|
||||||
/*
|
/*
|
||||||
* Byteswap an mmap'ed file if needed
|
* Byteswap an mmap'ed file if needed
|
||||||
*/
|
*/
|
||||||
@ -2335,3 +2346,4 @@ bs1(struct magic *m)
|
|||||||
m->num_mask = swap8(m->num_mask);
|
m->num_mask = swap8(m->num_mask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* COMPILE_ONLY */
|
||||||
|
@ -71,10 +71,10 @@ FILE_RCSID("@(#)$File: magic.c,v 1.62 2009/03/20 21:25:41 christos Exp $")
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
private void free_mlist(struct mlist *);
|
private void free_mlist(struct mlist *);
|
||||||
|
#ifndef COMPILE_ONLY
|
||||||
private void close_and_restore(const struct magic_set *, const char *, int,
|
private void close_and_restore(const struct magic_set *, const char *, int,
|
||||||
const struct stat *);
|
const struct stat *);
|
||||||
private int unreadable_info(struct magic_set *, mode_t, const char *);
|
private int unreadable_info(struct magic_set *, mode_t, const char *);
|
||||||
#ifndef COMPILE_ONLY
|
|
||||||
private const char *file_or_fd(struct magic_set *, const char *, int);
|
private const char *file_or_fd(struct magic_set *, const char *, int);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -132,6 +132,7 @@ free_mlist(struct mlist *mlist)
|
|||||||
free(ml);
|
free(ml);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef COMPILE_ONLY
|
||||||
private int
|
private int
|
||||||
unreadable_info(struct magic_set *ms, mode_t md, const char *file)
|
unreadable_info(struct magic_set *ms, mode_t md, const char *file)
|
||||||
{
|
{
|
||||||
@ -149,6 +150,7 @@ unreadable_info(struct magic_set *ms, mode_t md, const char *file)
|
|||||||
return -1;
|
return -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
public void
|
public void
|
||||||
magic_close(struct magic_set *ms)
|
magic_close(struct magic_set *ms)
|
||||||
@ -191,6 +193,7 @@ magic_check(struct magic_set *ms, const char *magicfile)
|
|||||||
return ml ? 0 : -1;
|
return ml ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef COMPILE_ONLY
|
||||||
private void
|
private void
|
||||||
close_and_restore(const struct magic_set *ms, const char *name, int fd,
|
close_and_restore(const struct magic_set *ms, const char *name, int fd,
|
||||||
const struct stat *sb)
|
const struct stat *sb)
|
||||||
@ -224,7 +227,6 @@ close_and_restore(const struct magic_set *ms, const char *name, int fd,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef COMPILE_ONLY
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* find type of descriptor
|
* find type of descriptor
|
||||||
@ -352,7 +354,7 @@ magic_buffer(struct magic_set *ms, const void *buf, size_t nb)
|
|||||||
}
|
}
|
||||||
return file_getbuffer(ms);
|
return file_getbuffer(ms);
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* COMPILE_ONLY */
|
||||||
|
|
||||||
public const char *
|
public const char *
|
||||||
magic_error(struct magic_set *ms)
|
magic_error(struct magic_set *ms)
|
||||||
|
Loading…
Reference in New Issue
Block a user