Commit 3e7d7ea3071edf18ce343872426d5c808dda8e17

Thomas de Grivel 2024-09-07T15:47:16

fix =

diff --git a/libkc3/frame.c b/libkc3/frame.c
index 37a3d87..a7fb881 100644
--- a/libkc3/frame.c
+++ b/libkc3/frame.c
@@ -173,23 +173,18 @@ s_frame * frame_new (s_frame *next)
 s_frame * frame_replace (s_frame *frame, const s_sym *sym,
                          s_tag *value)
 {
-  s_frame *f;
   s_tag *result;
   assert(sym);
-  f = frame;
-  while (f) {
-    result = binding_get_w(f->bindings, sym);
-    if (result) {
-      tag_clean(result);
-      if (value->type == TAG_VAR) {
-        tag_init_var(result, value->data.var.type);
-        value->data.var.ptr = result->data.var.ptr;
-      }
-      else
-        tag_init_copy(result, value);
-      return frame;
+  result = binding_get_w(frame->bindings, sym);
+  if (result) {
+    tag_clean(result);
+    if (value->type == TAG_VAR) {
+      tag_init_var(result, value->data.var.type);
+      value->data.var.ptr = result->data.var.ptr;
     }
-    f = f->next;
+    else
+      tag_init_copy(result, value);
+    return frame;
   }
   return frame_binding_new_copy(frame, sym, value);
 }