]> Nishi Git Mirror - libw3.git/commitdiff
reformat
authornishi <nishi@d27a3e52-49c5-7645-884c-6793ebffc270>
Tue, 30 Jan 2024 01:16:06 +0000 (01:16 +0000)
committernishi <nishi@d27a3e52-49c5-7645-884c-6793ebffc270>
Tue, 30 Jan 2024 01:16:06 +0000 (01:16 +0000)
git-svn-id: file:///raid/svn-main/nishi-libw3/trunk@137 d27a3e52-49c5-7645-884c-6793ebffc270

Example/w3b/w3b.c
Library/Tag.c

index 92f9092582d92f0e4b8458737bdcc0a4e59a6535..323326936f6924bd110b713b590e00233d7bda2c 100644 (file)
@@ -176,12 +176,12 @@ void html_handler(char* tagname, char* attr) {
                if(nl >= start) printf("\n");
                nl++;
        } else if(strcasecmp(tagname, "img") == 0) {
-               if(nl >= start){
+               if(nl >= start) {
                        char* alt = W3_Tag_Attr(attr, "alt");
-                       if(alt != NULL){
+                       if(alt != NULL) {
                                printf("[%s]", alt);
                                free(alt);
-                       }else{
+                       } else {
                                printf("[IMG]");
                        }
                }
index b3b48847b579684ee3ec7b1ff02abada3f2e0930..859024e24121739826a396c658d506e1051e1349 100644 (file)
@@ -73,7 +73,7 @@ void W3_Tag_Parse(char* data, size_t size, void (*tagfunc)(char* tagname, char*
        free(cbuf);
 }
 
-char* W3_Tag_Attr(char* data, const char* name){
+char* W3_Tag_Attr(char* data, const char* name) {
        char* ret = NULL;
        int i;
        int phase = 0;
@@ -82,24 +82,24 @@ char* W3_Tag_Attr(char* data, const char* name){
        char* key = malloc(1);
        key[0] = 0;
        bool dq = false;
-       for(i = 0;; i++){
+       for(i = 0;; i++) {
                cbuf[0] = data[i];
-               if(phase == 0 && data[i] != 0 && data[i] != '='){
+               if(phase == 0 && data[i] != 0 && data[i] != '=') {
                        char* tmp = key;
                        key = __W3_Concat(tmp, cbuf);
                        free(tmp);
-               }else if(phase == 0){
+               } else if(phase == 0) {
                        phase = 2;
                        if(strcasecmp(key, name) == 0) phase = 1;
                        free(key);
                        key = malloc(1);
                        key[0] = 0;
                        if(data[i] == 0) break;
-               }else if(phase == 1 && (dq ? dq : (data[i] != 0 && data[i] != ' '))){
-                       if(data[i] == '"'){
+               } else if(phase == 1 && (dq ? dq : (data[i] != 0 && data[i] != ' '))) {
+                       if(data[i] == '"') {
                                dq = !dq;
-                       }else{
-                               if(ret == NULL){
+                       } else {
+                               if(ret == NULL) {
                                        ret = malloc(1);
                                        ret[0] = 0;
                                }
@@ -107,14 +107,14 @@ char* W3_Tag_Attr(char* data, const char* name){
                                ret = __W3_Concat(tmp, cbuf);
                                free(tmp);
                        }
-               }else if(phase == 1){
+               } else if(phase == 1) {
                        phase = 0;
                        break;
-               }else if(phase == 2 && (dq ? dq : (data[i] != 0 && data[i] != ' '))){
-                       if(data[i] == '"'){
+               } else if(phase == 2 && (dq ? dq : (data[i] != 0 && data[i] != ' '))) {
+                       if(data[i] == '"') {
                                dq = !dq;
                        }
-               }else if(phase == 2){
+               } else if(phase == 2) {
                        phase = 0;
                        if(data[i] == 0) break;
                }