[hackers] [quark] minor code-style consistency fixes || Hiltjo Posthuma

From: <git_AT_suckless.org>
Date: Tue, 27 Jun 2017 23:31:29 +0200 (CEST)

commit fc0873853cd23a59a7dc12f02111c57ad17d6433
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
AuthorDate: Tue Jun 27 22:49:37 2017 +0200
Commit: Laslo Hunhold <dev_AT_frign.de>
CommitDate: Tue Jun 27 23:31:08 2017 +0200

    minor code-style consistency fixes
    
    :)

diff --git a/quark.c b/quark.c
index 578a591..8f1a91b 100644
--- a/quark.c
+++ b/quark.c
_AT_@ -96,8 +96,9 @@ static char *status_str[] = {
 static char *
 timestamp(time_t t, char buf[TIMESTAMP_LEN])
 {
- if (!t)
+ if (!t) {
                 t = time(NULL);
+ }
         strftime(buf, TIMESTAMP_LEN, "%a, %d %b %Y %T GMT", gmtime(&t));
 
         return buf;
_AT_@ -272,7 +273,7 @@ getrequest(int fd, struct request *r)
         for (; *p != '\0';) {
                 for (i = 0; i < NUM_REQ_FIELDS; i++) {
                         if (!strncasecmp(p, req_field_str[i],
- strlen(req_field_str[i]))) {
+ strlen(req_field_str[i]))) {
                                 break;
                         }
                 }
_AT_@ -320,8 +321,10 @@ compareent(const struct dirent **d1, const struct dirent **d2)
 
         v = ((*d2)->d_type == DT_DIR ? 1 : -1) -
             ((*d1)->d_type == DT_DIR ? 1 : -1);
- if (v)
+ if (v) {
                 return v;
+ }
+
         return strcmp((*d1)->d_name, (*d2)->d_name);
 }
 
_AT_@ -334,6 +337,7 @@ filetype(int t)
         case DT_LNK: return "_AT_";
         case DT_SOCK: return "=";
         }
+
         return "";
 }
 
_AT_@ -383,7 +387,7 @@ senddir(int fd, char *name, struct request *r)
                         /* entry line */
                         if (dprintf(fd, "<br />\n\t\t<a href=\"%s%s\">%s%s</a>",
                                     e[i]->d_name,
- e[i]->d_type & DT_DIR ? "/" : "",
+ (e[i]->d_type & DT_DIR ? "/" : ""),
                                     e[i]->d_name,
                                     filetype(e[i]->d_type)) < 0) {
                                 s = S_REQUEST_TIMEOUT;
_AT_@ -400,8 +404,9 @@ senddir(int fd, char *name, struct request *r)
         s = S_OK;
 
 cleanup:
- while (dirlen--)
+ while (dirlen--) {
                 free(e[dirlen]);
+ }
         free(e);
 
         return s;
_AT_@ -479,8 +484,9 @@ sendfile(int fd, char *name, struct request *r, struct stat *st, char *mime,
                 }
         }
 cleanup:
- if (fp)
+ if (fp) {
                 fclose(fp);
+ }
 
         return s;
 }
Received on Tue Jun 27 2017 - 23:31:29 CEST

This archive was generated by hypermail 2.3.0 : Tue Jun 27 2017 - 23:37:08 CEST