]> Nishi Git Mirror - dataworks.git/commitdiff
fix stuff
authornishi <nishi@d4a5a174-5a4a-5b4b-b672-37683c10d7d5>
Thu, 23 May 2024 03:39:13 +0000 (03:39 +0000)
committernishi <nishi@d4a5a174-5a4a-5b4b-b672-37683c10d7d5>
Thu, 23 May 2024 03:39:13 +0000 (03:39 +0000)
git-svn-id: file:///raid/svn-main/nishi-dataworks/trunk@85 d4a5a174-5a4a-5b4b-b672-37683c10d7d5

Client/main.c
Library/parser.c
common-decl.mk

index f0b27041af11accd7bdb014d71c933d8a6555414..42bc13da498814c2d7fd41bc3df01d51573f146c 100644 (file)
@@ -237,11 +237,13 @@ int main(int argc, char** argv) {
                                                                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;
+                                                       if(strlen(linebuf) > 0){
+                                                               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;
                                                }
                                        }
index 6ef9929f2493b72a3cdea0d8812a6d1f26bcf2a0..5a31c1585efe35fb95be6485c4850a3f88aca06d 100644 (file)
@@ -61,6 +61,12 @@ struct __dw_token* __dw_parser_parse(const char* name, const char* str) {
                        } else {
                                printf("%s:%s\n", buf, br);
                                __dw_parser_parse(buf, br);
+                               free(br);
+                               br = malloc(1);
+                               br[0] = 0;
+                               free(buf);
+                               buf = malloc(1);
+                               buf[0] = 0;
                        }
                } else if(dq) {
                        char* tmp = buf;
index bd35c343ee7f8702167156a5f9a1eff3454270ab..012e12d03eca372c08914a8925bf718a8fe70682 100644 (file)
@@ -5,7 +5,7 @@ SHCC = cc
 AR = ar
 AR_ARGS = rcs \$$@
 RANLIB = ranlib
-CFLAGS = -std=c99 -D_DEFAULT_SOURCE
+CFLAGS = -g -std=c99 -D_DEFAULT_SOURCE
 LDFLAGS = -L`pwd`/Library
 LIBS =
 LIB_PREFIX = lib