#include "my_assert.h"
#include "my_str.h"
+#include "common.h"
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
#define IS(w, y) !strcmp(w, y)
fwrite(line, 1, strlen(line), fout);
}
-// read a line, truncating it if it doesn't fit
-static char *my_fgets(char *s, size_t size, FILE *stream)
-{
- char *ret, *ret2;
- char buf[64];
- int p;
-
- p = size - 2;
- if (p >= 0)
- s[p] = 0;
-
- ret = fgets(s, size, stream);
- if (ret != NULL && p >= 0 && s[p] != 0 && s[p] != '\n') {
- p = sizeof(buf) - 2;
- do {
- buf[p] = 0;
- ret2 = fgets(buf, sizeof(buf), stream);
- }
- while (ret2 != NULL && buf[p] != 0 && buf[p] != '\n');
- }
-
- return ret;
-}
-
// '=' needs special treatment
// also ' quote
static char *next_word_s(char *w, size_t wsize, char *s)
if (wordc < 2)
continue;
+ if (IS_START(words[0], "__IMPORT_DESCRIPTOR_")) {
+ // when this starts, we don't need anything from this section
+ break;
+ }
+
if ((hg_var_cnt & 0xff) == 0) {
hg_vars = realloc(hg_vars, sizeof(hg_vars[0])
* (hg_var_cnt + 0x100));