+ SCM sub_sym = scm_caar (s);
+ SCM old_val = scm_cdar (s);
+ drop = false;
+
+ if (sub_sym == wanted_sym)
+ {
+ if (scm_is_pair (scm_cdr (prop_path)))
+ {
+ SCM new_val = nested_property_revert_alist (old_val, scm_cdr (prop_path));
+
+ /* nothing changed: drop newly constructed list. */
+ if (old_val == new_val)
+ return alist;
+
+ *tail = scm_acons (sub_sym, new_val, SCM_EOL);
+ tail = SCM_CDRLOC(*tail);
+ *tail = scm_cdr (s);
+ return new_list;
+ }
+ else
+ {
+ /* old value should be dropped only if we have another copy of it in the alist */
+ copy_count++;
+ /*
+ Only drop the first instance found.
+ the overridden value is always the first
+ if this was the only copy, we will return
+ the original list anyways so it is not relevant
+ if we drop this pair
+ */
+ if (copy_count == 1)
+ drop = true;
+ }
+ /* we now iterate over every item */
+ }
+ /*
+ Make a new list with every item
+ except for the eventual dropped one
+ */
+ if (!drop)
+ {
+ *tail = scm_acons (sub_sym, old_val, SCM_EOL);
+ tail = SCM_CDRLOC (*tail);
+ }