Browse Source

jimp: path -> file_path

rexim 1 month ago
parent
commit
e9c9c3c7f6
2 changed files with 7 additions and 7 deletions
  1. 3 3
      jimp.c
  2. 4 4
      jimp.h

+ 3 - 3
jimp.c

@@ -68,16 +68,16 @@ typedef struct {
 
 int main()
 {
-    const char *path = "profile.json";
+    const char *file_path = "profile.json";
     // const char *path = "numbers.json";
     // const char *path = "profiles.json";
     // const char *path = "empty.json";
     // const char *path = "one.json";
     // const char *path = "database.json";
     String_Builder sb = {0};
-    if (!read_entire_file(path, &sb)) return 1;
+    if (!read_entire_file(file_path, &sb)) return 1;
     Jimp jimp = {
-        .path = path,
+        .file_path = file_path,
     };
     static char string_store[1024];
     stb_c_lexer_init(&jimp.l, sb.items, sb.items + sb.count, string_store, sizeof(string_store));

+ 4 - 4
jimp.h

@@ -5,7 +5,7 @@
 
 typedef struct {
     stb_lexer l;
-    const char *path;
+    const char *file_path;
     const char *member;
 } Jimp;
 
@@ -97,7 +97,7 @@ void jimp_unknown_member(Jimp *jimp)
 {
     stb_lex_location loc = {0};
     stb_c_lexer_get_location(&jimp->l, jimp->l.where_firstchar, &loc);
-    fprintf(stderr, "%s:%d:%d: ERROR: Unexpected member `%s`\n", jimp->path, loc.line_number, loc.line_offset + 1, jimp->member);
+    fprintf(stderr, "%s:%d:%d: ERROR: Unexpected member `%s`\n", jimp->file_path, loc.line_number, loc.line_offset + 1, jimp->member);
 }
 
 bool jimp_object_begin(Jimp *jimp)
@@ -147,7 +147,7 @@ bool jimp_bool(Jimp *jimp, bool *boolean)
     } else {
         stb_lex_location loc = {0};
         stb_c_lexer_get_location(&jimp->l, jimp->l.where_firstchar, &loc);
-        fprintf(stderr, "%s:%d:%d: ERROR: Expected boolean but got `%s`\n", jimp->path, loc.line_number, loc.line_offset + 1, jimp_token_kind(jimp->l.token));
+        fprintf(stderr, "%s:%d:%d: ERROR: Expected boolean but got `%s`\n", jimp->file_path, loc.line_number, loc.line_offset + 1, jimp_token_kind(jimp->l.token));
         return false;
     }
     return true;
@@ -172,7 +172,7 @@ bool jimp_expect_token(Jimp *jimp, long token)
     if (jimp->l.token != token) {
         stb_lex_location loc = {0};
         stb_c_lexer_get_location(&jimp->l, jimp->l.where_firstchar, &loc);
-        fprintf(stderr, "%s:%d:%d: ERROR: expected %s, but got %s\n", jimp->path, loc.line_number, loc.line_offset + 1, jimp_token_kind(token), jimp_token_kind(jimp->l.token));
+        fprintf(stderr, "%s:%d:%d: ERROR: expected %s, but got %s\n", jimp->file_path, loc.line_number, loc.line_offset + 1, jimp_token_kind(token), jimp_token_kind(jimp->l.token));
         return false;
     }
     return true;