[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Lynx-dev] maybe better HTContentTypeToCompressType patch?

From: Thorsten Glaser
Subject: [Lynx-dev] maybe better HTContentTypeToCompressType patch?
Date: Fri, 26 Dec 2008 13:43:28 +0000 (UTC)

HTEncodingToCompressType has this redundant, should maybe fixed too:
• the { } are not needed
• assigning to result is redundant, it’s already initialised to cftNone
• we can shortcut the return

Index: HTFile.c
RCS file: /cvs/src/gnu/usr.bin/lynx/WWW/Library/Implementation/HTFile.c,v
retrieving revision
diff -u -p -r1.1.109.6 HTFile.c
--- HTFile.c    16 Dec 2008 23:13:07 -0000
+++ HTFile.c    26 Dec 2008 13:43:09 -0000
@@ -1336,6 +1336,8 @@ CompressFileType HTContentTypeToCompress
     CompressFileType method = cftNone;
+    if (ct == NULL)
+       return cftNone;
     if (!strncasecomp(ct, "application/gzip", 16) ||
        !strncasecomp(ct, "application/x-gzip", 18)) {
        method = cftGzip;

Sometimes they [people] care too much: pretty printers [and syntax highligh-
ting, d.A.] mechanically produce pretty output that accentuates irrelevant
detail in the program, which is as sensible as putting all the prepositions
in English text in bold font.   -- Rob Pike in "Notes on Programming in C"

reply via email to

[Prev in Thread] Current Thread [Next in Thread]