Kaynağa Gözat

helper: remove whitespace between if and left parenthesis

Marco Wang 5 yıl önce
ebeveyn
işleme
c668d26862
2 değiştirilmiş dosya ile 11 ekleme ve 11 silme
  1. 10
    10
      src/helpers.c
  2. 1
    1
      src/helpers.h

+ 10
- 10
src/helpers.c Dosyayı Görüntüle

@@ -16,13 +16,13 @@ bool light_file_read_uint64(char const *filename, uint64_t *val)
16 16
     uint64_t data;
17 17
 
18 18
     fp = fopen(filename, "r");
19
-    if (!fp)
19
+    if(!fp)
20 20
     {
21 21
         LIGHT_PERMERR("reading");
22 22
         return false;
23 23
     }
24 24
 
25
-    if (fscanf(fp, "%lu", &data) != 1)
25
+    if(fscanf(fp, "%lu", &data) != 1)
26 26
     {
27 27
         LIGHT_ERR("Couldn't parse an unsigned integer from '%s'", filename);
28 28
         fclose(fp);
@@ -40,13 +40,13 @@ bool light_file_write_uint64(char const *filename, uint64_t val)
40 40
     FILE *fp;
41 41
 
42 42
     fp = fopen(filename, "w");
43
-    if (!fp)
43
+    if(!fp)
44 44
     {
45 45
         LIGHT_PERMERR("writing");
46 46
         return false;
47 47
     }
48 48
 
49
-    if (fprintf(fp, "%lu", val) < 0)
49
+    if(fprintf(fp, "%lu", val) < 0)
50 50
     {
51 51
         LIGHT_ERR("fprintf failed");
52 52
         fclose(fp);
@@ -68,7 +68,7 @@ bool light_file_is_writable(char const *filename)
68 68
     FILE *fp;
69 69
 
70 70
     fp = fopen(filename, "r+");
71
-    if (!fp)
71
+    if(!fp)
72 72
     {
73 73
         LIGHT_PERMWARN("writing");
74 74
         return false;
@@ -84,7 +84,7 @@ bool light_file_is_readable(char const *filename)
84 84
     FILE *fp;
85 85
 
86 86
     fp = fopen(filename, "r");
87
-    if (!fp)
87
+    if(!fp)
88 88
     {
89 89
         LIGHT_PERMWARN("reading");
90 90
         return false;
@@ -111,13 +111,13 @@ uint64_t light_log_clamp_max(uint64_t max)
111 111
 /* Clamps the `percent` value between 0% and 100% */
112 112
 double light_percent_clamp(double val)
113 113
 {
114
-    if (val < 0.0)
114
+    if(val < 0.0)
115 115
     {
116 116
         LIGHT_WARN("specified value %g%% is not valid, adjusting it to 0%%", val);
117 117
         return 0.0;
118 118
     }
119 119
 
120
-    if (val > 100.0)
120
+    if(val > 100.0)
121 121
     {
122 122
         LIGHT_WARN("specified value %g%% is not valid, adjusting it to 100%%", val);
123 123
         return 100.0;
@@ -130,13 +130,13 @@ int light_mkpath(char *dir, mode_t mode)
130 130
 {
131 131
     struct stat sb;
132 132
 
133
-    if (!dir)
133
+    if(!dir)
134 134
     {
135 135
         errno = EINVAL;
136 136
         return -1;
137 137
     }
138 138
 
139
-    if (!stat(dir, &sb))
139
+    if(!stat(dir, &sb))
140 140
         return 0;
141 141
 
142 142
     char *tempdir = strdup(dir);

+ 1
- 1
src/helpers.h Dosyayı Görüntüle

@@ -24,7 +24,7 @@ typedef enum {
24 24
 light_loglevel_t light_loglevel;
25 25
 
26 26
 #define LIGHT_LOG(lvl, fp, fmt, args...)\
27
-    if (light_loglevel >= lvl)\
27
+    if(light_loglevel >= lvl)\
28 28
         fprintf(fp, "%s:%d:" fmt "\n", __FILE__, __LINE__, ##args)
29 29
 
30 30
 #define LIGHT_NOTE(fmt, args...) LIGHT_LOG(LIGHT_NOTE_LEVEL,  stdout, " Notice: " fmt, ##args)