Browse Source

helper: remove whitespace between if and left parenthesis

Marco Wang 5 years ago
parent
commit
c668d26862
2 changed files with 11 additions and 11 deletions
  1. 10
    10
      src/helpers.c
  2. 1
    1
      src/helpers.h

+ 10
- 10
src/helpers.c View File

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

+ 1
- 1
src/helpers.h View File

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