[svn-commits] tilghman: branch tilghman/malloc_hold r205219 - in /team/tilghman/malloc_hold...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Jul 8 11:56:30 CDT 2009


Author: tilghman
Date: Wed Jul  8 11:56:27 2009
New Revision: 205219

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=205219
Log:
More debug

Modified:
    team/tilghman/malloc_hold/include/asterisk/config.h
    team/tilghman/malloc_hold/main/config.c
    team/tilghman/malloc_hold/res/res_config_odbc.c
    team/tilghman/malloc_hold/res/res_config_pgsql.c

Modified: team/tilghman/malloc_hold/include/asterisk/config.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/tilghman/malloc_hold/include/asterisk/config.h?view=diff&rev=205219&r1=205218&r2=205219
==============================================================================
--- team/tilghman/malloc_hold/include/asterisk/config.h (original)
+++ team/tilghman/malloc_hold/include/asterisk/config.h Wed Jul  8 11:56:27 2009
@@ -45,7 +45,11 @@
 	char stuff[0];
 };
 
+#ifdef MALLOC_DEBUG
+typedef struct ast_config *config_load_func(const char *database, const char *table, const char *configfile, struct ast_config *config, int withcomments, const char *who_asked);
+#else
 typedef struct ast_config *config_load_func(const char *database, const char *table, const char *configfile, struct ast_config *config, int withcomments);
+#endif
 typedef struct ast_variable *realtime_var_get(const char *database, const char *table, va_list ap);
 typedef struct ast_config *realtime_multi_get(const char *database, const char *table, va_list ap);
 typedef int realtime_update(const char *database, const char *table, const char *keyfield, const char *entity, va_list ap);
@@ -65,7 +69,12 @@
  *
  * Returns NULL on error, or an ast_config data structure on success
  */
+#ifdef MALLOC_DEBUG
+#define	ast_config_load(a)	ast_config_load2(a,__FILE__)
+struct ast_config *ast_config_load2(const char *filename, const char *who_asked);
+#else
 struct ast_config *ast_config_load(const char *filename);
+#endif
 struct ast_config *ast_config_load_with_comments(const char *filename);
 
 /*! \brief Destroys a config 
@@ -202,7 +211,11 @@
 
 int config_text_file_save(const char *filename, const struct ast_config *cfg, const char *generator);
 
+#ifdef MALLOC_DEBUG
+struct ast_config *ast_config_internal_load(const char *configfile, struct ast_config *cfg, int withcomments, const char *who_asked);
+#else
 struct ast_config *ast_config_internal_load(const char *configfile, struct ast_config *cfg, int withcomments);
+#endif
 
 #if defined(__cplusplus) || defined(c_plusplus)
 }

Modified: team/tilghman/malloc_hold/main/config.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/tilghman/malloc_hold/main/config.c?view=diff&rev=205219&r1=205218&r2=205219
==============================================================================
--- team/tilghman/malloc_hold/main/config.c (original)
+++ team/tilghman/malloc_hold/main/config.c Wed Jul  8 11:56:27 2009
@@ -757,7 +757,11 @@
 				} else
 					exec_file[0] = '\0';
 				/* A #include */
+#ifdef MALLOC_DEBUG
+				do_include = ast_config_internal_load(cur, cfg, withcomments, "config.c") ? 1 : 0;
+#else
 				do_include = ast_config_internal_load(cur, cfg, withcomments) ? 1 : 0;
+#endif
 				if(!ast_strlen_zero(exec_file))
 					unlink(exec_file);
 				if (!do_include) {
@@ -829,7 +833,11 @@
 	return 0;
 }
 
+#ifdef MALLOC_DEBUG
+static struct ast_config *config_text_file_load(const char *database, const char *table, const char *filename, struct ast_config *cfg, int withcomments, const char *who_asked)
+#else
 static struct ast_config *config_text_file_load(const char *database, const char *table, const char *filename, struct ast_config *cfg, int withcomments)
+#endif
 {
 	char fn[256];
 #if defined(LOW_MEMORY)
@@ -981,7 +989,7 @@
 					char *buf = ast_strip(process_buf);
 					if (!ast_strlen_zero(buf)) {
 #ifdef MALLOC_DEBUG
-						if (process_text_line(cfg, &cat, buf, lineno, fn, withcomments, &comment_buffer, &comment_buffer_size, &lline_buffer, &lline_buffer_size, filename, lineno, table)) {
+						if (process_text_line(cfg, &cat, buf, lineno, fn, withcomments, &comment_buffer, &comment_buffer_size, &lline_buffer, &lline_buffer_size, filename, lineno, who_asked)) {
 #else
 						if (process_text_line(cfg, &cat, buf, lineno, fn, withcomments, &comment_buffer, &comment_buffer_size, &lline_buffer, &lline_buffer_size)) {
 #endif
@@ -1221,7 +1229,11 @@
 
 	configtmp = ast_config_new();
 	configtmp->max_include_level = 1;
+#ifdef MALLOC_DEBUG
+	config = ast_config_internal_load(extconfig_conf, configtmp, 0, "config.c");
+#else
 	config = ast_config_internal_load(extconfig_conf, configtmp, 0);
+#endif
 	if (!config) {
 		ast_config_destroy(configtmp);
 		return 0;
@@ -1360,7 +1372,11 @@
 	.load_func = config_text_file_load,
 };
 
+#ifdef MALLOC_DEBUG
+struct ast_config *ast_config_internal_load(const char *filename, struct ast_config *cfg, int withcomments, const char *who_asked)
+#else
 struct ast_config *ast_config_internal_load(const char *filename, struct ast_config *cfg, int withcomments)
+#endif
 {
 	char db[256];
 	char table[256];
@@ -1390,7 +1406,11 @@
 		}
 	}
 
+#ifdef MALLOC_DEBUG
+	result = loader->load_func(db, table, filename, cfg, withcomments, who_asked);
+#else
 	result = loader->load_func(db, table, filename, cfg, withcomments);
+#endif
 
 	if (result)
 		result->include_level--;
@@ -1400,7 +1420,11 @@
 	return result;
 }
 
+#ifdef MALLOC_DEBUG
+struct ast_config *ast_config_load2(const char *filename, const char *who_asked)
+#else
 struct ast_config *ast_config_load(const char *filename)
+#endif
 {
 	struct ast_config *cfg;
 	struct ast_config *result;
@@ -1409,7 +1433,11 @@
 	if (!cfg)
 		return NULL;
 
+#ifdef MALLOC_DEBUG
+	result = ast_config_internal_load(filename, cfg, 0, who_asked);
+#else
 	result = ast_config_internal_load(filename, cfg, 0);
+#endif
 	if (!result)
 		ast_config_destroy(cfg);
 
@@ -1425,7 +1453,11 @@
 	if (!cfg)
 		return NULL;
 
+#ifdef MALLOC_DEBUG
+	result = ast_config_internal_load(filename, cfg, 1, "config.c");
+#else
 	result = ast_config_internal_load(filename, cfg, 1);
+#endif
 	if (!result)
 		ast_config_destroy(cfg);
 

Modified: team/tilghman/malloc_hold/res/res_config_odbc.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/tilghman/malloc_hold/res/res_config_odbc.c?view=diff&rev=205219&r1=205218&r2=205219
==============================================================================
--- team/tilghman/malloc_hold/res/res_config_odbc.c (original)
+++ team/tilghman/malloc_hold/res/res_config_odbc.c Wed Jul  8 11:56:27 2009
@@ -450,7 +450,11 @@
 	return sth;
 }
 
+#ifdef MALLOC_DEBUG
+static struct ast_config *config_odbc(const char *database, const char *table, const char *file, struct ast_config *cfg, int withcomments, const char *who_asked)
+#else
 static struct ast_config *config_odbc(const char *database, const char *table, const char *file, struct ast_config *cfg, int withcomments)
+#endif
 {
 	struct ast_variable *new_v;
 	struct ast_category *cur_cat;
@@ -506,7 +510,11 @@
 
 	while ((res = SQLFetch(stmt)) != SQL_NO_DATA) {
 		if (!strcmp (q.var_name, "#include")) {
+#ifdef MALLOC_DEBUG
+			if (!ast_config_internal_load(q.var_val, cfg, 0, __FILE__)) {
+#else
 			if (!ast_config_internal_load(q.var_val, cfg, 0)) {
+#endif
 				SQLFreeHandle(SQL_HANDLE_STMT, stmt);
 				ast_odbc_release_obj(obj);
 				return NULL;

Modified: team/tilghman/malloc_hold/res/res_config_pgsql.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/tilghman/malloc_hold/res/res_config_pgsql.c?view=diff&rev=205219&r1=205218&r2=205219
==============================================================================
--- team/tilghman/malloc_hold/res/res_config_pgsql.c (original)
+++ team/tilghman/malloc_hold/res/res_config_pgsql.c Wed Jul  8 11:56:27 2009
@@ -490,7 +490,11 @@
 
 static struct ast_config *config_pgsql(const char *database, const char *table,
 					   const char *file, struct ast_config *cfg,
+#ifdef MALLOC_DEBUG
+					   int withcomments, const char *who_asked)
+#else
 					   int withcomments)
+#endif
 {
 	PGresult *result = NULL;
 	long num_rows;
@@ -556,7 +560,11 @@
 			char *field_var_val = PQgetvalue(result, rowIndex, 2);
 			char *field_cat_metric = PQgetvalue(result, rowIndex, 3);
 			if (!strcmp(field_var_name, "#include")) {
+#ifdef MALLOC_DEBUG
+				if (!ast_config_internal_load(field_var_val, cfg, 0, __FILE__)) {
+#else
 				if (!ast_config_internal_load(field_var_val, cfg, 0)) {
+#endif
 					PQclear(result);
 					ast_mutex_unlock(&pgsql_lock);
 					return NULL;




More information about the svn-commits mailing list