[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mandoc-source
Subject:    mdocml: preconv_encode() can take a const input buffer; diff from
From:       schwarze () mdocml ! bsd ! lv
Date:       2017-02-18 13:44:22
Message-ID: 7723038090044671549.enqueue () fantadrom ! bsd ! lv
[Download RAW message or body]

Log Message:
-----------
preconv_encode() can take a const input buffer;
diff from <christos at NetBSD>

Modified Files:
--------------
    mdocml:
        libmandoc.h
        preconv.c

Revision Data
-------------
Index: libmandoc.h
===================================================================
RCS file: /home/cvs/mdocml/mdocml/libmandoc.h,v
retrieving revision 1.65
retrieving revision 1.66
diff -Llibmandoc.h -Llibmandoc.h -u -p -r1.65 -r1.66
--- libmandoc.h
+++ libmandoc.h
@@ -59,7 +59,7 @@ int		 man_parseln(struct roff_man *, int
 void		 man_endparse(struct roff_man *);
 
 int		 preconv_cue(const struct buf *, size_t);
-int		 preconv_encode(struct buf *, size_t *,
+int		 preconv_encode(const struct buf *, size_t *,
 			struct buf *, size_t *, int *);
 
 void		 roff_free(struct roff *);
Index: preconv.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/preconv.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -Lpreconv.c -Lpreconv.c -u -p -r1.15 -r1.16
--- preconv.c
+++ preconv.c
@@ -26,14 +26,14 @@
 #include "libmandoc.h"
 
 int
-preconv_encode(struct buf *ib, size_t *ii, struct buf *ob, size_t *oi,
+preconv_encode(const struct buf *ib, size_t *ii, struct buf *ob, size_t *oi,
     int *filenc)
 {
-	unsigned char	*cu;
-	int		 nby;
-	unsigned int	 accum;
+	const unsigned char	*cu;
+	int			 nby;
+	unsigned int		 accum;
 
-	cu = (unsigned char *)ib->buf + *ii;
+	cu = (const unsigned char *)ib->buf + *ii;
 	assert(*cu & 0x80);
 
 	if ( ! (*filenc & MPARSE_UTF8))
@@ -90,7 +90,7 @@ preconv_encode(struct buf *ib, size_t *i
 	assert(accum < 0xd800 || accum > 0xdfff);
 
 	*oi += snprintf(ob->buf + *oi, 11, "\\[u%.4X]", accum);
-	*ii = (char *)cu - ib->buf;
+	*ii = (const char *)cu - ib->buf;
 	*filenc &= ~MPARSE_LATIN1;
 	return 1;
 
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic