Index: trunk/src/conf.c =================================================================== --- trunk/src/conf.c (revision 1944) +++ trunk/src/conf.c (revision 1945) @@ -644,7 +644,7 @@ return htsp_get(conf_fields, (char *)path); } -int conf_set(conf_role_t target, const char *path_, int arr_idx, const char *new_val, conf_policy_t pol) +int conf_set_dry(conf_role_t target, const char *path_, int arr_idx, const char *new_val, conf_policy_t pol) { char *path, *basename, *next, *last, *sidx; conf_native_t *nat; @@ -823,6 +823,16 @@ return 0; } +int conf_set(conf_role_t target, const char *path, int arr_idx, const char *new_val, conf_policy_t pol) +{ + int res; + res = conf_set_dry(target, path, arr_idx, new_val, pol); + if (res < 0) + return res; + conf_update(path); + return 0; +} + int conf_set_native(conf_native_t *field, int arr_idx, const char *new_val) { lht_node_t *node; Index: trunk/src/conf.h =================================================================== --- trunk/src/conf.h (revision 1944) +++ trunk/src/conf.h (revision 1945) @@ -140,10 +140,15 @@ void conf_unreg_fields(const char *prefix); -/* Set the value of path[arr_idx] in memory-lht role target to new_val using policy pol. Only lists should - be indexed. Indexing can be a [n] suffix on path or a non-negative arr_idx. */ +/* Set the value of path[arr_idx] in memory-lht role target to new_val using + policy pol. Only lists should be indexed. Indexing can be a [n] suffix on + path or a non-negative arr_idx. Updates the in-memory binary as well. */ int conf_set(conf_role_t target, const char *path, int arr_idx, const char *new_val, conf_policy_t pol); +/* Same as conf_set, but without updating the binary - useful for multiple + conf_set_dry calls and a single all-tree conf_udpate(NULL) for transactions. */ +int conf_set_dry(conf_role_t target, const char *path_, int arr_idx, const char *new_val, conf_policy_t pol); + /* Same as conf_set, but doesn't look up where to set things: change the value of the lihata node backing the native field */ int conf_set_native(conf_native_t *field, int arr_idx, const char *new_val); @@ -219,14 +224,10 @@ char *__tmp__ = pcb_strdup_printf(fmt, new_val); \ conf_set(CFR_DESIGN, path, -1, __tmp__, POL_OVERWRITE); \ free(__tmp__); \ - conf_update(path); \ } while(0) #define conf_set_editor(field, val) \ -do { \ - conf_set(CFR_DESIGN, "editor/" #field, -1, val ? "1" : "0", POL_OVERWRITE); \ - conf_update("editor/" #field); \ -} while(0) + conf_set(CFR_DESIGN, "editor/" #field, -1, val ? "1" : "0", POL_OVERWRITE) #define conf_toggle_editor(field) \ conf_set_editor(field, !conf_core.editor.field) Index: trunk/src/conf_act.c =================================================================== --- trunk/src/conf_act.c (revision 1944) +++ trunk/src/conf_act.c (revision 1945) @@ -87,7 +87,6 @@ Message("conf(set) failed.\n"); return 1; } - conf_update(path); } else if (NSTRCMP(cmd, "toggle") == 0) { @@ -131,7 +130,7 @@ conf_update(argv[1]); } - else if (NSTRCMP(cmd, "toggle") == 0) { + else if (NSTRCMP(cmd, "reset") == 0) { conf_role_t role; int res; role = conf_role_parse(argv[1]); Index: trunk/src/hid_flags.c =================================================================== --- trunk/src/hid_flags.c (revision 1944) +++ trunk/src/hid_flags.c (revision 1945) @@ -74,7 +74,6 @@ } else { fprintf(stderr, "ERROR: hid_get_flag(%s) - not a path or an action\n", name); -// abort(); } } return -1; Index: trunk/src/main.c =================================================================== --- trunk/src/main.c (revision 1944) +++ trunk/src/main.c (revision 1945) @@ -208,7 +208,6 @@ } sprintf(exec_prefix, "%s%s%s", bindir, PCB_DIR_SEPARATOR_S, BINDIR_TO_EXECPREFIX); conf_set(CFR_INTERNAL, "rc/path/exec_prefix", -1, exec_prefix, POL_OVERWRITE); - conf_update("rc/path/exec_prefix"); free(exec_prefix); free(bindir); } Index: trunk/src/set.c =================================================================== --- trunk/src/set.c (revision 1944) +++ trunk/src/set.c (revision 1945) @@ -166,7 +166,6 @@ { if (Number >= 0 && Number < MAX_BUFFER) { conf_set_design("editor/buffer_number", "%d", Number); - conf_update("editor/buffer_number"); /* do an update on the crosshair range */ SetCrosshairRangeToBuffer(); @@ -234,7 +233,6 @@ Crosshair.AttachedLine.Point1.Y = Crosshair.AttachedLine.Point2.Y = Crosshair.AttachedBox.Point1.Y; sprintf(sMode, "%d", Mode); conf_set(CFR_DESIGN, "editor/mode", -1, sMode, POL_OVERWRITE); - conf_update("editor/mode"); AdjustAttachedObjects(); } else { @@ -252,7 +250,6 @@ sprintf(sMode, "%d", Mode); conf_set(CFR_DESIGN, "editor/mode", -1, sMode, POL_OVERWRITE); - conf_update("editor/mode"); if (Mode == PASTEBUFFER_MODE) /* do an update on the crosshair range */ Index: trunk/src_plugins/hid_gtk/gtkhid-main.c =================================================================== --- trunk/src_plugins/hid_gtk/gtkhid-main.c (revision 1944) +++ trunk/src_plugins/hid_gtk/gtkhid-main.c (revision 1945) @@ -1624,7 +1624,6 @@ if (new_unit != NULL && new_unit->allow != NO_PRINT) { #warning TODO: decide what to do with this: some fields are just overwritten by hand conf_set(CFR_DESIGN, "editor/grid_unit", -1, argv[0], POL_OVERWRITE); - conf_update("editor/grid_unit"); AttributePut(PCB, "PCB::grid::unit", argv[0]); } Index: trunk/src_plugins/hid_gtk/gui-config.c =================================================================== --- trunk/src_plugins/hid_gtk/gui-config.c (revision 1944) +++ trunk/src_plugins/hid_gtk/gui-config.c (revision 1945) @@ -764,7 +764,6 @@ conf_set(CFR_PROJECT, "design/max_width", -1, s, POL_OVERWRITE); pcb_sprintf(s, "%$mS", (new_board_height)); conf_set(CFR_PROJECT, "design/max_height", -1, s, POL_OVERWRITE); - conf_update("design/max_height"); #warning TODO: what? this could be removed once user can select where to save active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(use_board_size_default_button)); @@ -1514,7 +1513,6 @@ printf("COLOR IDX: %d\n", ci->idx); conf_set(CFR_PROJECT, ci->cfg->hash_path, ci->idx, str, POL_OVERWRITE); - conf_update(ci->cfg->hash_path); #warning TODO: check whether we need to free this // g_free(str);