[gq-commit] gq/src configfile.c,1.34,1.35 configfile.h,1.23,1.24
Status: Beta
Brought to you by:
sur5r
From: <sta...@us...> - 2003-10-05 13:34:53
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv3733 Modified Files: configfile.c configfile.h Log Message: * Got rid of many, many fixed size buffers. These might have been problematic with variable length characters (as in the standard UTF-8 encoding) * now error_push allows for printf-style variable argument lists, very convenient: no more dealing with an extra message buffer for variable messages. Got rid of many such buffers * Got rid of most hand-knit linked list implementations, replaced them with GLists (errorchains, config->ldapservers, etc.) * Many object types now have constructors and destructors of the form new_<type> and free_<type>. Use them instead of self-allocating and freeing memory as it was done before. Removed all such old style object handling * removed unneeded prototypes * Removed the old parser entirely Index: configfile.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/configfile.c,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** configfile.c 5 Oct 2003 00:36:39 -0000 1.34 --- configfile.c 5 Oct 2003 13:34:49 -0000 1.35 *************** *** 48,112 **** #include "syntax.h" #include "gq-xml.h" struct gq_config *config; - #ifdef OLD_PARSER - struct keywordlist configwords[] = { - { "gq-config", T_GQ_CONFIG , NEEDS_CLOSE }, - - /* global options */ [...1185 lines suppressed...] ! g_list_foreach(cfg->templates, (GFunc) free_template, NULL); g_list_free(cfg->templates); /* free filters */ ! ! g_list_foreach(cfg->filters, (GFunc) free_filter, NULL); g_list_free(cfg->filters); + /* free default display type hash */ + g_hash_table_foreach_remove(cfg->defaultDT, default_dt_remove, NULL); g_hash_table_destroy(cfg->defaultDT); cfg->defaultDT = NULL; ! /* free object itself */ ! ! g_free(cfg); } /* Index: configfile.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/configfile.h,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** configfile.h 4 Oct 2003 10:15:46 -0000 1.23 --- configfile.h 5 Oct 2003 13:34:49 -0000 1.24 *************** *** 28,34 **** #include <stdio.h> - #include <glib.h> #define CURRENT_CONFIG_VERSION 2 --- 28,35 ---- #include <stdio.h> #include <glib.h> + #include "common.h" + #define CURRENT_CONFIG_VERSION 2 *************** *** 37,40 **** --- 38,42 ---- #define RCFILE ".gq" + #if 0 /* do not forget to set T_HIGHEST to the highest used token value below */ *************** *** 105,108 **** --- 107,112 ---- #define NEEDS_CLOSE 1 #define NEEDS_DATA 2 + #endif + #define BINDTYPE_SIMPLE 0 *************** *** 147,151 **** newer config file. */ ! struct ldapserver *ldapservers; GList *templates; GList *filters; --- 151,155 ---- newer config file. */ ! GList *servers; GList *templates; GList *filters; *************** *** 158,162 **** int sort_browse; int show_rdn_only; ! char schemaserver[64]; GHashTable *defaultDT; --- 162,166 ---- int sort_browse; int show_rdn_only; ! char *schemaserver; GHashTable *defaultDT; *************** *** 170,173 **** --- 174,178 ---- }; + #if 0 enum parselevel { TOP, IN_TAG, END *************** *** 197,201 **** char *cur_dt_attr; }; ! /* handy for writing config file */ --- 202,206 ---- char *cur_dt_attr; }; ! #endif /* handy for writing config file */ *************** *** 206,215 **** ! struct ldapserver *new_ldapserver(struct gq_config *config); ! struct gq_template *new_template(void); ! struct gq_filter *new_filter(void); ! void delete_ldapserver(struct ldapserver *dserver); char *homedir(void); - void init_ldapserver(struct ldapserver *server); /* filename_config returns the name of the config file. The returned --- 211,223 ---- ! void config_add_server(struct gq_config *config, ! struct ldapserver *newserver); ! void config_remove_server(struct gq_config *config, ! struct ldapserver *server); ! ! struct ldapserver *new_ldapserver(void); ! void free_ldapserver(struct ldapserver *server); ! char *homedir(void); /* filename_config returns the name of the config file. The returned *************** *** 221,230 **** void init_config(void); ! void cleanup_config(struct gq_config *cfg); ! ! /* cleanup_config + free */ void free_config(struct gq_config *cfg); - - void default_config(struct gq_config *cfg); extern struct gq_config *config; --- 229,234 ---- void init_config(void); ! struct gq_config *new_config(void); void free_config(struct gq_config *cfg); extern struct gq_config *config; |