From: kristaps@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: Const-ify some mchars arguments.
Date: Mon, 7 Nov 2011 19:15:23 -0500 (EST) [thread overview]
Message-ID: <201111080015.pA80FN0W027582@krisdoz.my.domain> (raw)
Log Message:
-----------
Const-ify some mchars arguments. I think these are non-const for historical
dumbness on my part.
Modified Files:
--------------
mdocml:
chars.c
mandoc.3
mandoc.h
Revision Data
-------------
Index: chars.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/chars.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -Lchars.c -Lchars.c -u -p -r1.51 -r1.52
--- chars.c
+++ chars.c
@@ -51,7 +51,8 @@ struct mchars {
struct ln **htab;
};
-static const struct ln *find(struct mchars *, const char *, size_t);
+static const struct ln *find(const struct mchars *,
+ const char *, size_t);
void
mchars_free(struct mchars *arg)
@@ -96,7 +97,7 @@ mchars_alloc(void)
}
int
-mchars_spec2cp(struct mchars *arg, const char *p, size_t sz)
+mchars_spec2cp(const struct mchars *arg, const char *p, size_t sz)
{
const struct ln *ln;
@@ -113,7 +114,8 @@ mchars_num2char(const char *p, size_t sz
if ((i = mandoc_strntoi(p, sz, 10)) < 0)
return('\0');
- return(i > 0 && i < 256 && isprint(i) ? i : '\0');
+ return(i > 0 && i < 256 && isprint(i) ?
+ /* LINTED */ i : '\0');
}
int
@@ -128,7 +130,8 @@ mchars_num2uc(const char *p, size_t sz)
}
const char *
-mchars_spec2str(struct mchars *arg, const char *p, size_t sz, size_t *rsz)
+mchars_spec2str(const struct mchars *arg,
+ const char *p, size_t sz, size_t *rsz)
{
const struct ln *ln;
@@ -143,9 +146,9 @@ mchars_spec2str(struct mchars *arg, cons
}
static const struct ln *
-find(struct mchars *tab, const char *p, size_t sz)
+find(const struct mchars *tab, const char *p, size_t sz)
{
- struct ln *pp;
+ const struct ln *pp;
int hash;
assert(p);
Index: mandoc.3
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandoc.3,v
retrieving revision 1.15
retrieving revision 1.16
diff -Lmandoc.3 -Lmandoc.3 -u -p -r1.15 -r1.16
--- mandoc.3
+++ mandoc.3
@@ -76,14 +76,14 @@
.Fn mchars_num2uc "const char *cp" "size_t sz"
.Ft "const char *"
.Fo mchars_spec2str
-.Fa "struct mchars *p"
+.Fa "const struct mchars *p"
.Fa "const char *cp"
.Fa "size_t sz"
.Fa "size_t *rsz"
.Fc
.Ft int
.Fo mchars_spec2cp
-.Fa "struct mchars *p"
+.Fa "const struct mchars *p"
.Fa "const char *cp"
.Fa "size_t sz"
.Ft "const char *"
Index: mandoc.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandoc.h,v
retrieving revision 1.97
retrieving revision 1.98
diff -Lmandoc.h -Lmandoc.h -u -p -r1.97 -r1.98
--- mandoc.h
+++ mandoc.h
@@ -409,9 +409,9 @@ struct mchars *mchars_alloc(void);
void mchars_free(struct mchars *);
char mchars_num2char(const char *, size_t);
int mchars_num2uc(const char *, size_t);
-int mchars_spec2cp(struct mchars *,
+int mchars_spec2cp(const struct mchars *,
const char *, size_t);
-const char *mchars_spec2str(struct mchars *,
+const char *mchars_spec2str(const struct mchars *,
const char *, size_t, size_t *);
struct mparse *mparse_alloc(enum mparset,
enum mandoclevel, mandocmsg, void *);
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
reply other threads:[~2011-11-08 0:15 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201111080015.pA80FN0W027582@krisdoz.my.domain \
--to=kristaps@mdocml.bsd.lv \
--cc=source@mdocml.bsd.lv \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).