* mdocml: The files mandoc.c and mandoc.h contained both specialised
@ 2014-03-23 11:59 schwarze
0 siblings, 0 replies; 2+ messages in thread
From: schwarze @ 2014-03-23 11:59 UTC (permalink / raw)
To: source
Log Message:
-----------
The files mandoc.c and mandoc.h contained both specialised low-level
functions used for multiple languages (mdoc, man, roff), for example
mandoc_escape(), mandoc_getarg(), mandoc_eos(), and generic auxiliary
functions. Split the auxiliaries out into their own file and header.
Added Files:
-----------
mdocml:
mandoc_aux.h
mandoc_aux.c
Revision Data
-------------
--- /dev/null
+++ mandoc_aux.c
@@ -0,0 +1,105 @@
+/* $Id: mandoc_aux.c,v 1.1 2014/03/23 11:59:17 schwarze Exp $ */
+/*
+ * Copyright (c) 2009, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
+ * Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+#include <sys/types.h>
+
+#include <stdarg.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "mandoc.h"
+#include "mandoc_aux.h"
+
+int
+mandoc_asprintf(char **dest, const char *fmt, ...)
+{
+ va_list ap;
+ int ret;
+
+ va_start(ap, fmt);
+ ret = vasprintf(dest, fmt, ap);
+ va_end(ap);
+
+ if (-1 == ret) {
+ perror(NULL);
+ exit((int)MANDOCLEVEL_SYSERR);
+ }
+ return(ret);
+}
+
+void *
+mandoc_calloc(size_t num, size_t size)
+{
+ void *ptr;
+
+ ptr = calloc(num, size);
+ if (NULL == ptr) {
+ perror(NULL);
+ exit((int)MANDOCLEVEL_SYSERR);
+ }
+ return(ptr);
+}
+
+void *
+mandoc_malloc(size_t size)
+{
+ void *ptr;
+
+ ptr = malloc(size);
+ if (NULL == ptr) {
+ perror(NULL);
+ exit((int)MANDOCLEVEL_SYSERR);
+ }
+ return(ptr);
+}
+
+void *
+mandoc_realloc(void *ptr, size_t size)
+{
+
+ ptr = realloc(ptr, size);
+ if (NULL == ptr) {
+ perror(NULL);
+ exit((int)MANDOCLEVEL_SYSERR);
+ }
+ return(ptr);
+}
+
+char *
+mandoc_strdup(const char *ptr)
+{
+ char *p;
+
+ p = strdup(ptr);
+ if (NULL == p) {
+ perror(NULL);
+ exit((int)MANDOCLEVEL_SYSERR);
+ }
+ return(p);
+}
+
+char *
+mandoc_strndup(const char *ptr, size_t sz)
+{
+ char *p;
+
+ p = mandoc_malloc(sz + 1);
+ memcpy(p, ptr, sz);
+ p[(int)sz] = '\0';
+ return(p);
+}
--- /dev/null
+++ mandoc_aux.h
@@ -0,0 +1,32 @@
+/* $Id: mandoc_aux.h,v 1.1 2014/03/23 11:59:17 schwarze Exp $ */
+/*
+ * Copyright (c) 2009, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
+ * Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+#ifndef MANDOC_AUX_H
+#define MANDOC_AUX_H
+
+__BEGIN_DECLS
+
+int mandoc_asprintf(char **, const char *, ...);
+void *mandoc_calloc(size_t, size_t);
+void *mandoc_malloc(size_t);
+void *mandoc_realloc(void *, size_t);
+char *mandoc_strdup(const char *);
+char *mandoc_strndup(const char *, size_t);
+
+__END_DECLS
+
+#endif /*!MANDOC_AUX_H*/
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
^ permalink raw reply [flat|nested] 2+ messages in thread
* mdocml: The files mandoc.c and mandoc.h contained both specialised
@ 2014-03-23 11:25 schwarze
0 siblings, 0 replies; 2+ messages in thread
From: schwarze @ 2014-03-23 11:25 UTC (permalink / raw)
To: source
Log Message:
-----------
The files mandoc.c and mandoc.h contained both specialised low-level
functions used for multiple languages (mdoc, man, roff), for example
mandoc_escape(), mandoc_getarg(), mandoc_eos(), and generic auxiliary
functions. Split the auxiliaries out into their own file and header.
While here, do some #include cleanup.
Modified Files:
--------------
mdocml:
Makefile
arch.c
att.c
chars.c
eqn.c
html.c
lib.c
main.c
man.c
man_hash.c
man_validate.c
mandoc.3
mandoc.c
mandoc.h
mandocdb.c
manpath.c
mansearch.c
mdoc.c
mdoc_argv.c
mdoc_hash.c
mdoc_man.c
mdoc_validate.c
msec.c
out.c
read.c
roff.c
st.c
tbl.c
tbl_data.c
tbl_layout.c
term.c
term_ascii.c
term_ps.c
vol.c
Revision Data
-------------
Index: mdoc_hash.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_hash.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -Lmdoc_hash.c -Lmdoc_hash.c -u -p -r1.18 -r1.19
--- mdoc_hash.c
+++ mdoc_hash.c
@@ -28,7 +28,6 @@
#include <string.h>
#include "mdoc.h"
-#include "mandoc.h"
#include "libmdoc.h"
static unsigned char table[27 * 12];
Index: arch.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/arch.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -Larch.c -Larch.c -u -p -r1.9 -r1.10
--- arch.c
+++ arch.c
@@ -18,12 +18,9 @@
#include "config.h"
#endif
-#include <stdlib.h>
#include <string.h>
-#include <time.h>
#include "mdoc.h"
-#include "mandoc.h"
#include "libmdoc.h"
#define LINE(x, y) \
Index: main.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/main.c,v
retrieving revision 1.171
retrieving revision 1.172
diff -Lmain.c -Lmain.c -u -p -r1.171 -r1.172
--- main.c
+++ main.c
@@ -28,6 +28,7 @@
#include <unistd.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "main.h"
#include "mdoc.h"
#include "man.h"
Index: mdoc_validate.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_validate.c,v
retrieving revision 1.202
retrieving revision 1.203
diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.202 -r1.203
--- mdoc_validate.c
+++ mdoc_validate.c
@@ -36,6 +36,7 @@
#include "mdoc.h"
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libmdoc.h"
#include "libmandoc.h"
Index: st.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/st.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -Lst.c -Lst.c -u -p -r1.9 -r1.10
--- st.c
+++ st.c
@@ -18,12 +18,9 @@
#include "config.h"
#endif
-#include <stdlib.h>
#include <string.h>
-#include <time.h>
#include "mdoc.h"
-#include "mandoc.h"
#include "libmdoc.h"
#define LINE(x, y) \
Index: Makefile
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/Makefile,v
retrieving revision 1.413
retrieving revision 1.414
diff -LMakefile -LMakefile -u -p -r1.413 -r1.414
--- Makefile
+++ Makefile
@@ -124,6 +124,8 @@ SRCS = Makefile \
mandoc.3 \
mandoc.c \
mandoc.h \
+ mandoc_aux.c \
+ mandoc_aux.h \
mandoc_char.7 \
mandocdb.8 \
mandocdb.c \
@@ -201,6 +203,7 @@ LIBMANDOC_OBJS = $(LIBMAN_OBJS) \
$(LIBROFF_OBJS) \
chars.o \
mandoc.o \
+ mandoc_aux.o \
msec.o \
read.o
@@ -225,7 +228,7 @@ vol.o: vol.in
$(LIBMAN_OBJS): libman.h
$(LIBMDOC_OBJS): libmdoc.h
$(LIBROFF_OBJS): libroff.h
-$(LIBMANDOC_OBJS): mandoc.h mdoc.h man.h libmandoc.h config.h
+$(LIBMANDOC_OBJS): mandoc.h mandoc_aux.h mdoc.h man.h libmandoc.h config.h
$(COMPAT_OBJS): config.h compat_ohash.h
MANDOC_HTML_OBJS = eqn_html.o \
@@ -252,10 +255,11 @@ MANDOC_OBJS = $(MANDOC_HTML_OBJS) \
main.o \
out.o \
tree.o
-$(MANDOC_OBJS): main.h mandoc.h mdoc.h man.h config.h out.h
+$(MANDOC_OBJS): main.h mandoc.h mandoc_aux.h mdoc.h man.h config.h out.h
MANDOCDB_OBJS = mandocdb.o mansearch_const.o manpath.o
-$(MANDOCDB_OBJS): mansearch.h mandoc.h mdoc.h man.h config.h manpath.h
+$(MANDOCDB_OBJS): mansearch.h mandoc.h mandoc_aux.h \
+ mdoc.h man.h config.h manpath.h
PRECONV_OBJS = preconv.o
$(PRECONV_OBJS): config.h
Index: man_validate.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man_validate.c,v
retrieving revision 1.88
retrieving revision 1.89
diff -Lman_validate.c -Lman_validate.c -u -p -r1.88 -r1.89
--- man_validate.c
+++ man_validate.c
@@ -32,6 +32,7 @@
#include "man.h"
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libman.h"
#include "libmandoc.h"
Index: term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/term.c,v
retrieving revision 1.217
retrieving revision 1.218
diff -Lterm.c -Lterm.c -u -p -r1.217 -r1.218
--- term.c
+++ term.c
@@ -23,12 +23,12 @@
#include <assert.h>
#include <ctype.h>
-#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "out.h"
#include "term.h"
#include "main.h"
Index: man.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man.c,v
retrieving revision 1.124
retrieving revision 1.125
diff -Lman.c -Lman.c -u -p -r1.124 -r1.125
--- man.c
+++ man.c
@@ -30,6 +30,7 @@
#include "man.h"
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libman.h"
#include "libmandoc.h"
Index: mdoc.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc.c,v
retrieving revision 1.208
retrieving revision 1.209
diff -Lmdoc.c -Lmdoc.c -u -p -r1.208 -r1.209
--- mdoc.c
+++ mdoc.c
@@ -30,6 +30,7 @@
#include "mdoc.h"
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libmdoc.h"
#include "libmandoc.h"
Index: roff.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/roff.c,v
retrieving revision 1.200
retrieving revision 1.201
diff -Lroff.c -Lroff.c -u -p -r1.200 -r1.201
--- roff.c
+++ roff.c
@@ -26,6 +26,7 @@
#include <string.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libroff.h"
#include "libmandoc.h"
Index: att.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/att.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -Latt.c -Latt.c -u -p -r1.9 -r1.10
--- att.c
+++ att.c
@@ -18,12 +18,9 @@
#include "config.h"
#endif
-#include <stdlib.h>
#include <string.h>
-#include <time.h>
#include "mdoc.h"
-#include "mandoc.h"
#include "libmdoc.h"
#define LINE(x, y) \
Index: eqn.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/eqn.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -Leqn.c -Leqn.c -u -p -r1.38 -r1.39
--- eqn.c
+++ eqn.c
@@ -26,6 +26,7 @@
#include <time.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libmandoc.h"
#include "libroff.h"
Index: man_hash.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man_hash.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -Lman_hash.c -Lman_hash.c -u -p -r1.25 -r1.26
--- man_hash.c
+++ man_hash.c
@@ -23,7 +23,6 @@
#include <assert.h>
#include <ctype.h>
#include <limits.h>
-#include <stdlib.h>
#include <string.h>
#include "man.h"
Index: chars.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/chars.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -Lchars.c -Lchars.c -u -p -r1.55 -r1.56
--- chars.c
+++ chars.c
@@ -25,6 +25,7 @@
#include <string.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libmandoc.h"
#define PRINT_HI 126
Index: mdoc_man.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_man.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -Lmdoc_man.c -Lmdoc_man.c -u -p -r1.58 -r1.59
--- mdoc_man.c
+++ mdoc_man.c
@@ -23,6 +23,7 @@
#include <string.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "out.h"
#include "man.h"
#include "mdoc.h"
@@ -461,7 +462,7 @@ print_offs(const char *v)
/*
* Set up the indentation for a list item; used from pre_it().
*/
-void
+static void
print_width(const char *v, const struct mdoc_node *child, size_t defsz)
{
char buf[24];
@@ -513,7 +514,7 @@ print_width(const char *v, const struct
TPremain = remain;
}
-void
+static void
print_count(int *count)
{
char buf[12];
Index: html.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/html.c,v
retrieving revision 1.154
retrieving revision 1.155
diff -Lhtml.c -Lhtml.c -u -p -r1.154 -r1.155
--- html.c
+++ html.c
@@ -31,6 +31,7 @@
#include <unistd.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libmandoc.h"
#include "out.h"
#include "html.h"
Index: mandoc.3
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandoc.3,v
retrieving revision 1.23
retrieving revision 1.24
diff -Lmandoc.3 -Lmandoc.3 -u -p -r1.23 -r1.24
--- mandoc.3
+++ mandoc.3
@@ -20,7 +20,12 @@
.Os
.Sh NAME
.Nm mandoc ,
+.Nm mandoc_calloc ,
.Nm mandoc_escape ,
+.Nm mandoc_malloc ,
+.Nm mandoc_realloc ,
+.Nm mandoc_strdup ,
+.Nm mandoc_strndup ,
.Nm man_meta ,
.Nm man_mparse ,
.Nm man_node ,
@@ -45,28 +50,30 @@
.Sh LIBRARY
.Lb libmandoc
.Sh SYNOPSIS
-.In man.h
-.In mdoc.h
.In mandoc.h
+.Fd "#define ASCII_NBRSP"
+.Fd "#define ASCII_HYPH"
+.Fd "#define ASCII_BREAK"
+.Ft "void *"
+.Fo mandoc_calloc
+.Fa "size_t nmemb"
+.Fa "size_t size"
+.Fc
.Ft "enum mandoc_esc"
.Fo mandoc_escape
.Fa "const char **end"
.Fa "const char **start"
.Fa "int *sz"
.Fc
-.Ft "const struct man_meta *"
-.Fo man_meta
-.Fa "const struct man *man"
-.Fc
-.Ft "const struct mparse *"
-.Fo man_mparse
-.Fa "const struct man *man"
-.Fc
-.Ft "const struct man_node *"
-.Fo man_node
-.Fa "const struct man *man"
-.Fc
+.Ft "void *"
+.Fn mandoc_malloc "size_t size"
.Ft "struct mchars *"
+.Fo mandoc_realloc
+.Fa "void *ptr"
+.Fa "size_t size"
+.Fc
+.Ft "char *"
+.Fn mandoc_strdup
.Fn mchars_alloc "void"
.Ft void
.Fn mchars_free "struct mchars *p"
@@ -87,14 +94,6 @@
.Fa "const char *cp"
.Fa "size_t sz"
.Fc
-.Ft "const struct mdoc_meta *"
-.Fo mdoc_meta
-.Fa "const struct mdoc *mdoc"
-.Fc
-.Ft "const struct mdoc_node *"
-.Fo mdoc_node
-.Fa "const struct mdoc *mdoc"
-.Fc
.Ft void
.Fo mparse_alloc
.Fa "enum mparset inttype"
@@ -104,6 +103,15 @@
.Fa "int quick"
.Fc
.Ft void
+.Fo (*mandocmsg)
+.Fa "enum mandocerr errtype"
+.Fa "enum mandoclevel level"
+.Fa "const char *file"
+.Fa "int line"
+.Fa "int col"
+.Fa "const char *msg"
+.Fc
+.Ft void
.Fo mparse_free
.Fa "struct mparse *parse"
.Fc
@@ -139,11 +147,33 @@
.Fo mparse_strlevel
.Fa "enum mandoclevel"
.Fc
-.Vt extern const char * const * man_macronames;
+.In mandoc.h
+.In mdoc.h
+.Ft "const struct mdoc_meta *"
+.Fo mdoc_meta
+.Fa "const struct mdoc *mdoc"
+.Fc
+.Ft "const struct mdoc_node *"
+.Fo mdoc_node
+.Fa "const struct mdoc *mdoc"
+.Fc
.Vt extern const char * const * mdoc_argnames;
.Vt extern const char * const * mdoc_macronames;
-.Fd "#define ASCII_NBRSP"
-.Fd "#define ASCII_HYPH"
+.In mandoc.h
+.In man.h
+.Ft "const struct man_meta *"
+.Fo man_meta
+.Fa "const struct man *man"
+.Fc
+.Ft "const struct mparse *"
+.Fo man_mparse
+.Fa "const struct man *man"
+.Fc
+.Ft "const struct man_node *"
+.Fo man_node
+.Fa "const struct man *man"
+.Fc
+.Vt extern const char * const * man_macronames;
.Sh DESCRIPTION
The
.Nm mandoc
Index: term_ascii.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/term_ascii.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -Lterm_ascii.c -Lterm_ascii.c -u -p -r1.21 -r1.22
--- term_ascii.c
+++ term_ascii.c
@@ -20,7 +20,6 @@
#include <sys/types.h>
-#include <assert.h>
#ifdef USE_WCHAR
# include <locale.h>
#endif
@@ -33,6 +32,7 @@
#endif
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "out.h"
#include "term.h"
#include "main.h"
Index: term_ps.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/term_ps.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -Lterm_ps.c -Lterm_ps.c -u -p -r1.55 -r1.56
--- term_ps.c
+++ term_ps.c
@@ -30,6 +30,7 @@
#include <unistd.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "out.h"
#include "main.h"
#include "term.h"
Index: mandoc.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandoc.h,v
retrieving revision 1.117
retrieving revision 1.118
diff -Lmandoc.h -Lmandoc.h -u -p -r1.117 -r1.118
--- mandoc.h
+++ mandoc.h
@@ -1,7 +1,7 @@
/* $Id$ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -405,12 +405,7 @@ struct man;
__BEGIN_DECLS
-void *mandoc_calloc(size_t, size_t);
enum mandoc_esc mandoc_escape(const char **, const char **, int *);
-void *mandoc_malloc(size_t);
-void *mandoc_realloc(void *, size_t);
-char *mandoc_strdup(const char *);
-char *mandoc_strndup(const char *, size_t);
struct mchars *mchars_alloc(void);
void mchars_free(struct mchars *);
char mchars_num2char(const char *, size_t);
Index: tbl.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/tbl.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -Ltbl.c -Ltbl.c -u -p -r1.27 -r1.28
--- tbl.c
+++ tbl.c
@@ -26,6 +26,7 @@
#include <time.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libmandoc.h"
#include "libroff.h"
Index: vol.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/vol.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -Lvol.c -Lvol.c -u -p -r1.9 -r1.10
--- vol.c
+++ vol.c
@@ -18,12 +18,9 @@
#include "config.h"
#endif
-#include <stdlib.h>
#include <string.h>
-#include <time.h>
#include "mdoc.h"
-#include "mandoc.h"
#include "libmdoc.h"
#define LINE(x, y) \
Index: out.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/out.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -Lout.c -Lout.c -u -p -r1.46 -r1.47
--- out.c
+++ out.c
@@ -28,6 +28,7 @@
#include <string.h>
#include <time.h>
+#include "mandoc_aux.h"
#include "mandoc.h"
#include "out.h"
Index: tbl_data.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/tbl_data.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -Ltbl_data.c -Ltbl_data.c -u -p -r1.28 -r1.29
--- tbl_data.c
+++ tbl_data.c
@@ -26,6 +26,7 @@
#include <time.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libmandoc.h"
#include "libroff.h"
Index: lib.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/lib.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -Llib.c -Llib.c -u -p -r1.9 -r1.10
--- lib.c
+++ lib.c
@@ -18,12 +18,9 @@
#include "config.h"
#endif
-#include <stdlib.h>
#include <string.h>
-#include <time.h>
#include "mdoc.h"
-#include "mandoc.h"
#include "libmdoc.h"
#define LINE(x, y) \
Index: mandocdb.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandocdb.c,v
retrieving revision 1.118
retrieving revision 1.119
diff -Lmandocdb.c -Lmandocdb.c -u -p -r1.118 -r1.119
--- mandocdb.c
+++ mandocdb.c
@@ -46,6 +46,7 @@
#include "mdoc.h"
#include "man.h"
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "manpath.h"
#include "mansearch.h"
Index: mdoc_argv.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_argv.c,v
retrieving revision 1.89
retrieving revision 1.90
diff -Lmdoc_argv.c -Lmdoc_argv.c -u -p -r1.89 -r1.90
--- mdoc_argv.c
+++ mdoc_argv.c
@@ -28,6 +28,7 @@
#include "mdoc.h"
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libmdoc.h"
#include "libmandoc.h"
Index: mandoc.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandoc.c,v
retrieving revision 1.75
retrieving revision 1.76
diff -Lmandoc.c -Lmandoc.c -u -p -r1.75 -r1.76
--- mandoc.c
+++ mandoc.c
@@ -31,6 +31,7 @@
#include <time.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libmandoc.h"
#define DATESIZE 32
@@ -351,74 +352,6 @@ mandoc_escape(const char **end, const ch
}
return(gly);
-}
-
-void *
-mandoc_calloc(size_t num, size_t size)
-{
- void *ptr;
-
- ptr = calloc(num, size);
- if (NULL == ptr) {
- perror(NULL);
- exit((int)MANDOCLEVEL_SYSERR);
- }
-
- return(ptr);
-}
-
-
-void *
-mandoc_malloc(size_t size)
-{
- void *ptr;
-
- ptr = malloc(size);
- if (NULL == ptr) {
- perror(NULL);
- exit((int)MANDOCLEVEL_SYSERR);
- }
-
- return(ptr);
-}
-
-
-void *
-mandoc_realloc(void *ptr, size_t size)
-{
-
- ptr = realloc(ptr, size);
- if (NULL == ptr) {
- perror(NULL);
- exit((int)MANDOCLEVEL_SYSERR);
- }
-
- return(ptr);
-}
-
-char *
-mandoc_strndup(const char *ptr, size_t sz)
-{
- char *p;
-
- p = mandoc_malloc(sz + 1);
- memcpy(p, ptr, sz);
- p[(int)sz] = '\0';
- return(p);
-}
-
-char *
-mandoc_strdup(const char *ptr)
-{
- char *p;
-
- p = strdup(ptr);
- if (NULL == p) {
- perror(NULL);
- exit((int)MANDOCLEVEL_SYSERR);
- }
-
- return(p);
}
/*
Index: mansearch.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mansearch.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -Lmansearch.c -Lmansearch.c -u -p -r1.22 -r1.23
--- mansearch.c
+++ mansearch.c
@@ -39,6 +39,7 @@
#include <sqlite3.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "manpath.h"
#include "mansearch.h"
Index: manpath.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/manpath.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -Lmanpath.c -Lmanpath.c -u -p -r1.12 -r1.13
--- manpath.c
+++ manpath.c
@@ -26,7 +26,7 @@
#include <stdlib.h>
#include <string.h>
-#include "mandoc.h"
+#include "mandoc_aux.h"
#include "manpath.h"
#define MAN_CONF_FILE "/etc/man.conf"
Index: tbl_layout.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/tbl_layout.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -Ltbl_layout.c -Ltbl_layout.c -u -p -r1.23 -r1.24
--- tbl_layout.c
+++ tbl_layout.c
@@ -19,13 +19,13 @@
#include "config.h"
#endif
-#include <assert.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libmandoc.h"
#include "libroff.h"
Index: msec.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/msec.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -Lmsec.c -Lmsec.c -u -p -r1.10 -r1.11
--- msec.c
+++ msec.c
@@ -18,7 +18,6 @@
#include "config.h"
#endif
-#include <stdlib.h>
#include <string.h>
#include "mandoc.h"
Index: read.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/read.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -Lread.c -Lread.c -u -p -r1.45 -r1.46
--- read.c
+++ read.c
@@ -37,6 +37,7 @@
#include <unistd.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libmandoc.h"
#include "mdoc.h"
#include "man.h"
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-03-23 11:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-23 11:59 mdocml: The files mandoc.c and mandoc.h contained both specialised schwarze
-- strict thread matches above, loose matches on Subject: below --
2014-03-23 11:25 schwarze
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).