roken: move Heimdal vis.h extensions to separate header

vis.h is not built on platforms (such as macOS) that already have
that header, which resulted in prototypes for Heimdal-specific
vis.h extensions being absent.

Move those prototypes to a separate header, vis-extras.h, which
must be explicitly included in order to use the Heimdal extensions.
This commit is contained in:
Luke Howard
2021-05-17 09:57:00 +10:00
parent cc5bd3a6c0
commit f67dd0f903
9 changed files with 37 additions and 10 deletions

@ -35,7 +35,8 @@
#include "der_locl.h"
#include "heim_asn1.h"
#include "vis.h"
#include <vis.h>
#include <vis-extras.h>
RCSID("$Id$");

@ -41,6 +41,7 @@
#include "gen_locl.h"
#include <vis.h>
#include <vis-extras.h>
static const char *symbol_name(const char *, const Type *);
static void generate_template_type(const char *, const char **, const char *, const char *, const char *,

@ -36,6 +36,7 @@
#include "der_locl.h"
#include <com_err.h>
#include <vis.h>
#include <vis-extras.h>
struct asn1_type_func asn1_template_prim[A1T_NUM_ENTRY] = {
#define el(name, type) { \

@ -33,6 +33,7 @@
#include "hx_locl.h"
#include <vis.h>
#include <vis-extras.h>
/**
* @page page_print Hx509 printing functions

@ -89,7 +89,7 @@ else
vis_h = vis.h
endif
rkvis_SOURCES = vis.c $(vis_h)
rkvis_SOURCES = vis.c $(vis_h) vis-extras.h
rkvis_CPPFLAGS = -DTEST
rkbase32_SOURCES = base32.c
@ -179,6 +179,7 @@ libroken_la_SOURCES = \
unvis.c \
vis.c \
$(vis_h) \
vis-extras.h \
warnerr.c \
write_pid.c \
xfree.c \

@ -179,6 +179,7 @@ INCFILES = \
$(INCDIR)\stdbool.h \
$(INCDIR)\syslog.h \
$(INCDIR)\vis.h \
$(INCDIR)\vis-extras.h \
!ifndef HAVE_STDINT_H
$(INCDIR)\stdint.h \
!endif

27
lib/roken/vis-extras.h Normal file

@ -0,0 +1,27 @@
#ifndef _VIS_EXTRAS_H_
#define _VIS_EXTRAS_H_
#include <roken.h>
ROKEN_CPP_START
ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
rk_strasvis(char **, const char *, int, const char *);
ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
rk_strasvisx(char **, const char *, size_t, int, const char *);
ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
rk_strrasvis(char **, size_t *, const char *, int, const char *);
ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
rk_strrasvisx(char **, size_t *, const char *, size_t, int, const char *);
ROKEN_CPP_END
#define strasvis(a, b, c, d) rk_strasvis(a, b, c, d)
#define strasvisx(a, b, c, d) rk_strasvisx(a, b, c, d)
#define strrasvis(a, b, c, d) rk_strrasvis(a, b, c, d)
#define strrasvisx(a, b, c, d) rk_strrasvisx(a, b, c, d)
#endif /* !_VIS_EXTRAS_H_ */

@ -396,6 +396,8 @@ rk_strsvisx(char *dst, const char *csrc, size_t len, int flag, const char *extra
* buffer as needed. Based on OpenBSD's stravis().
*/
#include <vis-extras.h>
ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
rk_strasvis(char **out, const char *csrc, int flag, const char *extra)
{

@ -117,14 +117,6 @@ ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
rk_strvisx(char *, const char *, size_t, int);
ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
rk_strsvisx(char *, const char *, size_t, int, const char *);
ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
rk_strasvis(char **, const char *, int, const char *);
ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
rk_strasvisx(char **, const char *, size_t, int, const char *);
ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
rk_strrasvis(char **, size_t *, const char *, int, const char *);
ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
rk_strrasvisx(char **, size_t *, const char *, size_t, int, const char *);
ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
rk_strunvis(char *, const char *);
ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL