source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: merge OpenBSD rev.
Date: Fri, 11 Jul 2014 18:27:36 -0400 (EDT)	[thread overview]
Message-ID: <201407112227.s6BMRaRZ027586@krisdoz.my.domain> (raw)

Log Message:
-----------
merge OpenBSD rev. 1.3 by tedu@:
make http decode linear time.
also remove a redundant null check.

Modified Files:
--------------
    mdocml:
        cgi.c

Revision Data
-------------
Index: cgi.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/cgi.c,v
retrieving revision 1.62
retrieving revision 1.63
diff -Lcgi.c -Lcgi.c -u -p -r1.62 -r1.63
--- cgi.c
+++ cgi.c
@@ -165,7 +165,7 @@ html_printquery(const struct req *req)
 	}
 	if (NULL != req->q.expr) {
 		printf("&amp;expr=");
-		html_print(req->q.expr ? req->q.expr : "");
+		html_print(req->q.expr);
 	}
 }
 
@@ -284,11 +284,13 @@ static int
 http_decode(char *p)
 {
 	char             hex[3];
+	char		*q;
 	int              c;
 
 	hex[2] = '\0';
 
-	for ( ; '\0' != *p; p++) {
+	q = p;
+	for ( ; '\0' != *p; p++, q++) {
 		if ('%' == *p) {
 			if ('\0' == (hex[0] = *(p + 1)))
 				return(0);
@@ -299,13 +301,13 @@ http_decode(char *p)
 			if ('\0' == c)
 				return(0);
 
-			*p = (char)c;
-			memmove(p + 1, p + 3, strlen(p + 3) + 1);
+			*q = (char)c;
+			p += 2;
 		} else
-			*p = '+' == *p ? ' ' : *p;
+			*q = '+' == *p ? ' ' : *p;
 	}
 
-	*p = '\0';
+	*q = '\0';
 	return(1);
 }
 
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

             reply	other threads:[~2014-07-11 22:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-11 22:27 schwarze [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-07-11 22:25 schwarze
2014-06-18 19:34 mdocml: Merge " schwarze
2014-04-04 15:51 mdocml: merge " schwarze
2013-09-17 23:12 mdocml: Merge " schwarze
2013-09-17 23:07 schwarze
2013-09-17 22:48 mdocml: merge " schwarze

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=201407112227.s6BMRaRZ027586@krisdoz.my.domain \
    --to=schwarze@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).