@@ -1263,21 +1263,9 @@ static DeclType decl_type_from_name(const char *name) {
12631263 return TYPE_UNKNOWN ;
12641264}
12651265
1266- static EnvEntry * env_find_local_entry (Env * env , const char * name ) {
1267- if (!env || !name ) {
1268- return NULL ;
1269- }
1270- for (size_t i = 0 ; i < env -> count ; i ++ ) {
1271- if (strcmp (env -> entries [i ].name , name ) == 0 ) {
1272- return & env -> entries [i ];
1273- }
1274- }
1275- return NULL ;
1276- }
1277-
12781266static Env * env_find_owner (Env * env , const char * name ) {
12791267 for (Env * e = env ; e != NULL ; e = e -> parent ) {
1280- if (env_find_local_entry (e , name )) {
1268+ if (env_find_local (e , name )) {
12811269 return e ;
12821270 }
12831271 }
@@ -3514,7 +3502,7 @@ static Env *deser_env(JsonValue *obj, UnserCtx *ctx, Interpreter *interp, const
35143502 for (size_t i = 0 ; i < declared -> as .obj .count ; i ++ ) {
35153503 JsonPair * p = & declared -> as .obj .items [i ];
35163504 DeclType dt = decl_type_from_name (p -> value && p -> value -> type == JSON_STR ? p -> value -> as .str : NULL );
3517- if (!env_find_local_entry (env , p -> key )) {
3505+ if (!env_find_local (env , p -> key )) {
35183506 env_define (env , p -> key , dt , 0 , value_null ());
35193507 }
35203508 }
@@ -3525,10 +3513,10 @@ static Env *deser_env(JsonValue *obj, UnserCtx *ctx, Interpreter *interp, const
35253513 for (size_t i = 0 ; i < values -> as .obj .count ; i ++ ) {
35263514 JsonPair * p = & values -> as .obj .items [i ];
35273515 JsonValue * vv = p -> value ;
3528- if (!env_find_local_entry (env , p -> key )) {
3516+ if (!env_find_local (env , p -> key )) {
35293517 env_define (env , p -> key , TYPE_UNKNOWN , 0 , value_null ());
35303518 }
3531- EnvEntry * entry = env_find_local_entry (env , p -> key );
3519+ EnvEntry * entry = env_find_local (env , p -> key );
35323520 if (vv && vv -> type == JSON_OBJ ) {
35333521 JsonValue * vt = json_obj_get (vv , "t" );
35343522 if (vt && vt -> type == JSON_STR && strcmp (vt -> as .str , "PTR" ) == 0 ) {
@@ -3565,7 +3553,7 @@ static Env *deser_env(JsonValue *obj, UnserCtx *ctx, Interpreter *interp, const
35653553 if (schemas && schemas -> type == JSON_OBJ ) {
35663554 for (size_t i = 0 ; i < schemas -> as .obj .count ; i ++ ) {
35673555 JsonPair * p = & schemas -> as .obj .items [i ];
3568- EnvEntry * entry = env_find_local_entry (env , p -> key );
3556+ EnvEntry * entry = env_find_local (env , p -> key );
35693557 if (entry ) {
35703558 Value s = deser_val (p -> value , ctx , interp , err );
35713559 if (* err == NULL ) {
@@ -3581,10 +3569,10 @@ static Env *deser_env(JsonValue *obj, UnserCtx *ctx, Interpreter *interp, const
35813569 for (size_t i = 0 ; i < frozen -> as .arr .count ; i ++ ) {
35823570 JsonValue * it = frozen -> as .arr .items [i ];
35833571 if (it && it -> type == JSON_STR ) {
3584- EnvEntry * e = env_find_local_entry (env , it -> as .str );
3572+ EnvEntry * e = env_find_local (env , it -> as .str );
35853573 if (!e ) {
35863574 env_define (env , it -> as .str , TYPE_UNKNOWN , 0 , value_null ());
3587- e = env_find_local_entry (env , it -> as .str );
3575+ e = env_find_local (env , it -> as .str );
35883576 }
35893577 if (e ) {
35903578 e -> frozen = true;
@@ -3598,10 +3586,10 @@ static Env *deser_env(JsonValue *obj, UnserCtx *ctx, Interpreter *interp, const
35983586 for (size_t i = 0 ; i < perma -> as .arr .count ; i ++ ) {
35993587 JsonValue * it = perma -> as .arr .items [i ];
36003588 if (it && it -> type == JSON_STR ) {
3601- EnvEntry * e = env_find_local_entry (env , it -> as .str );
3589+ EnvEntry * e = env_find_local (env , it -> as .str );
36023590 if (!e ) {
36033591 env_define (env , it -> as .str , TYPE_UNKNOWN , 0 , value_null ());
3604- e = env_find_local_entry (env , it -> as .str );
3592+ e = env_find_local (env , it -> as .str );
36053593 }
36063594 if (e ) {
36073595 e -> permafrozen = true;
0 commit comments