Browse Source

rfc822: Rename RFC822_HDR_BAD_NAME constant

This error constant is actually more specific than the name suggests - it
indicates that a header field name contains characters which are not
permitted in a header field name.  Rename the constant to better reflect
this, likewise rename the testcase based around it.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
David Gibson 13 years ago
parent
commit
4be05500e6
3 changed files with 4 additions and 4 deletions
  1. 1 1
      ccan/rfc822/rfc822.c
  2. 1 1
      ccan/rfc822/rfc822.h
  3. 2 2
      ccan/rfc822/test/run-bad-header-name-chars.c

+ 1 - 1
ccan/rfc822/rfc822.c

@@ -257,7 +257,7 @@ enum rfc822_header_errors rfc822_header_errors(struct rfc822_msg *msg,
 			assert(c != ':');
 
 			if ((c < 33) || (c > 126)) {
-				err |= RFC822_HDR_BAD_NAME;
+				err |= RFC822_HDR_BAD_NAME_CHARS;
 				break;
 			}
 		}

+ 1 - 1
ccan/rfc822/rfc822.h

@@ -117,7 +117,7 @@ struct bytestring rfc822_body(struct rfc822_msg *msg);
 
 enum rfc822_header_errors {
 	RFC822_HDR_NO_COLON = 1,
-	RFC822_HDR_BAD_NAME = 2,
+	RFC822_HDR_BAD_NAME_CHARS = 2,
 };
 
 enum rfc822_header_errors rfc822_header_errors(struct rfc822_msg *msg,

+ 2 - 2
ccan/rfc822/test/run-bad-header-name.c → ccan/rfc822/test/run-bad-header-name-chars.c

@@ -40,7 +40,7 @@ static bool bad_name(const char *buf, char c)
 
 	allocation_failure_check();
 
-	ok1(!(errs & ~RFC822_HDR_BAD_NAME));
+	ok1(!(errs & ~RFC822_HDR_BAD_NAME_CHARS));
 
 	/* Check raw_name still works properly */
 	hname = rfc822_header_raw_name(msg, hdr);
@@ -55,7 +55,7 @@ static bool bad_name(const char *buf, char c)
 
 	allocation_failure_check();
 
-	return !!(errs & RFC822_HDR_BAD_NAME);
+	return !!(errs & RFC822_HDR_BAD_NAME_CHARS);
 }
 
 int main(int argc, char *argv[])