]> Nishi Git Mirror - dataworks.git/commitdiff
watcom does not like goto
authornishi <nishi@d4a5a174-5a4a-5b4b-b672-37683c10d7d5>
Wed, 22 May 2024 23:23:32 +0000 (23:23 +0000)
committernishi <nishi@d4a5a174-5a4a-5b4b-b672-37683c10d7d5>
Wed, 22 May 2024 23:23:32 +0000 (23:23 +0000)
git-svn-id: file:///raid/svn-main/nishi-dataworks/trunk@83 d4a5a174-5a4a-5b4b-b672-37683c10d7d5

Client/main.c

index bc82cde5013b828743052cd7a96023e91272825e..c7bcdf0fdd18ba3f9f0300d0a5a74fd97d7caab0 100644 (file)
@@ -216,32 +216,34 @@ int main(int argc, char** argv) {
                                linebuf = __dw_strcat(tmp, buf);
                                free(tmp);
                                int i;
-rep:;
-                               for(i = 0; linebuf[i] != 0; i++){
-                                       if(linebuf[i] == ';'){
-                                               char* line = malloc(i + 1);
-                                               line[i] = 0;
-                                               memcpy(line, linebuf, i);
-                                               struct __dw_token* token = __dw_parser_parse(NULL, line);
-                                               if(token != NULL) {
-                                                       if(token->error) {
-                                                               printf("%s\n", dataworks_database_strerror(token->errnum));
+                               while(true){
+                                       for(i = 0; linebuf[i] != 0; i++){
+                                               if(linebuf[i] == ';'){
+                                                       char* line = malloc(i + 1);
+                                                       line[i] = 0;
+                                                       memcpy(line, linebuf, i);
+                                                       struct __dw_token* token = __dw_parser_parse(NULL, line);
+                                                       if(token != NULL) {
+                                                               if(token->error) {
+                                                                       printf("%s\n", dataworks_database_strerror(token->errnum));
+                                                               } else {
+                                                               }
                                                        } else {
+                                                               printf("Parser returned NULL. Help!\n");
                                                        }
-                                               } else {
-                                                       printf("Parser returned NULL. Help!\n");
-                                               }
-                                               if(fprog != NULL){
-                                                       printf("%s\n", line);
+                                                       if(fprog != NULL){
+                                                               printf("%s\n", line);
+                                                       }
+                                                       free(line);
+                                                       char* newbuf = malloc(strlen(linebuf) - i);
+                                                       newbuf[strlen(linebuf) - i - 1] = 0;
+                                                       memcpy(newbuf, linebuf + i + 1, strlen(linebuf) - i - 1);
+                                                       free(linebuf);
+                                                       linebuf = newbuf;
+                                                       continue;
                                                }
-                                               free(line);
-                                               char* newbuf = malloc(strlen(linebuf) - i);
-                                               newbuf[strlen(linebuf) - i - 1] = 0;
-                                               memcpy(newbuf, linebuf + i + 1, strlen(linebuf) - i - 1);
-                                               free(linebuf);
-                                               linebuf = newbuf;
-                                               goto rep;
                                        }
+                                       break;
                                }
                        }
                        if(fprog == NULL){