[asterisk-commits] rizzo: trunk r93581 - in /trunk: build_tools/make_defaults_h main/asterisk.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Dec 18 03:26:03 CST 2007


Author: rizzo
Date: Tue Dec 18 03:26:03 2007
New Revision: 93581

URL: http://svn.digium.com/view/asterisk?view=rev&rev=93581
Log:
Rename the macros in defaults.h - they are not meant to be
globally visible.

Document the fact that DEFAULT_TMP_DIR cannot be overridden
from the default configuration (this needs to be fixed, as you
could have a totally different spooldir configured at runtime,
and yet DEFAULT_TMP_DIR keeps the compile-time default).

Remove two unused entries for sounds and images.


Modified:
    trunk/build_tools/make_defaults_h
    trunk/main/asterisk.c

Modified: trunk/build_tools/make_defaults_h
URL: http://svn.digium.com/view/asterisk/trunk/build_tools/make_defaults_h?view=diff&rev=93581&r1=93580&r2=93581
==============================================================================
--- trunk/build_tools/make_defaults_h (original)
+++ trunk/build_tools/make_defaults_h Tue Dec 18 03:26:03 2007
@@ -2,25 +2,27 @@
 cat << END
 /*
  * defaults.h 
- * Automatically generated
+ * Automatically generated from build options,
+ * only used in main/asterisk.c
  */
-#define AST_CONFIG_DIR "${INSTALL_PATH}${ASTETCDIR}"
-#define AST_RUN_DIR    "${INSTALL_PATH}${ASTVARRUNDIR}"
-#define AST_SOCKET     "${INSTALL_PATH}${ASTVARRUNDIR}/asterisk.ctl"
-#define AST_PID        "${INSTALL_PATH}${ASTVARRUNDIR}/asterisk.pid"
-#define AST_MODULE_DIR "${INSTALL_PATH}${MODULES_DIR}"
-#define AST_SPOOL_DIR  "${INSTALL_PATH}${ASTSPOOLDIR}"
-#define AST_VAR_DIR    "${INSTALL_PATH}${ASTVARLIBDIR}"
-#define AST_DATA_DIR   "${INSTALL_PATH}${ASTDATADIR}"
-#define AST_LOG_DIR    "${INSTALL_PATH}${ASTLOGDIR}"
-#define AST_AGI_DIR    "${INSTALL_PATH}${AGI_DIR}"
-#define AST_KEY_DIR    "${INSTALL_PATH}${ASTDATADIR}/keys"
-#define AST_DB         "${INSTALL_PATH}${ASTVARLIBDIR}/astdb"
-#define AST_TMP_DIR    "${INSTALL_PATH}${ASTSPOOLDIR}/tmp"
+#define DEFAULT_CONFIG_FILE "${INSTALL_PATH}${ASTCONFPATH}"
 
-#define AST_CONFIG_FILE "${INSTALL_PATH}${ASTCONFPATH}"
+#define DEFAULT_CONFIG_DIR "${INSTALL_PATH}${ASTETCDIR}"
+#define DEFAULT_MODULE_DIR "${INSTALL_PATH}${MODULES_DIR}"
+#define DEFAULT_AGI_DIR    "${INSTALL_PATH}${AGI_DIR}"
+#define DEFAULT_LOG_DIR    "${INSTALL_PATH}${ASTLOGDIR}"
 
-#define AST_SOUNDS     "${INSTALL_PATH}${ASTDATADIR}/sounds"
-#define AST_IMAGES     "${INSTALL_PATH}${ASTDATADIR}/images"
+#define DEFAULT_RUN_DIR    "${INSTALL_PATH}${ASTVARRUNDIR}"
+#define DEFAULT_SOCKET     "${INSTALL_PATH}${ASTVARRUNDIR}/asterisk.ctl"
+#define DEFAULT_PID        "${INSTALL_PATH}${ASTVARRUNDIR}/asterisk.pid"
+
+#define DEFAULT_VAR_DIR    "${INSTALL_PATH}${ASTVARLIBDIR}"
+#define DEFAULT_DB         "${INSTALL_PATH}${ASTVARLIBDIR}/astdb"
+
+#define DEFAULT_DATA_DIR   "${INSTALL_PATH}${ASTDATADIR}"
+#define DEFAULT_KEY_DIR    "${INSTALL_PATH}${ASTDATADIR}/keys"
+
+#define DEFAULT_SPOOL_DIR  "${INSTALL_PATH}${ASTSPOOLDIR}"
+#define DEFAULT_TMP_DIR    "${INSTALL_PATH}${ASTSPOOLDIR}/tmp"
 
 END

Modified: trunk/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/trunk/main/asterisk.c?view=diff&rev=93581&r1=93580&r2=93581
==============================================================================
--- trunk/main/asterisk.c (original)
+++ trunk/main/asterisk.c Tue Dec 18 03:26:03 2007
@@ -164,7 +164,8 @@
 
 /*! @} */
 
-char record_cache_dir[AST_CACHE_DIR_LEN] = AST_TMP_DIR;
+/* XXX tmpdir is a subdir of the spool directory, and no way to remap it */
+char record_cache_dir[AST_CACHE_DIR_LEN] = DEFAULT_TMP_DIR;
 
 static int ast_socket = -1;		/*!< UNIX Socket for allowing remote control */
 static int ast_consock = -1;		/*!< UNIX Socket for controlling another asterisk */
@@ -2402,7 +2403,7 @@
 {
 	struct ast_config *cfg;
 	struct ast_variable *v;
-	char *config = AST_CONFIG_FILE;
+	char *config = DEFAULT_CONFIG_FILE;
 	char hostname[MAXHOSTNAMELEN] = "";
 	struct ast_flags config_flags = { 0 };
 	struct {
@@ -2418,19 +2419,19 @@
 		cfg = ast_config_load(config, config_flags);
 
 	/* init with buildtime config */
-	ast_copy_string(ast_config_AST_CONFIG_DIR, AST_CONFIG_DIR, sizeof(ast_config_AST_CONFIG_DIR));
-	ast_copy_string(ast_config_AST_SPOOL_DIR, AST_SPOOL_DIR, sizeof(ast_config_AST_SPOOL_DIR));
-	ast_copy_string(ast_config_AST_MODULE_DIR, AST_MODULE_DIR, sizeof(ast_config_AST_MODULE_DIR));
+	ast_copy_string(ast_config_AST_CONFIG_DIR, DEFAULT_CONFIG_DIR, sizeof(ast_config_AST_CONFIG_DIR));
+	ast_copy_string(ast_config_AST_SPOOL_DIR, DEFAULT_SPOOL_DIR, sizeof(ast_config_AST_SPOOL_DIR));
+	ast_copy_string(ast_config_AST_MODULE_DIR, DEFAULT_MODULE_DIR, sizeof(ast_config_AST_MODULE_DIR));
  	snprintf(ast_config_AST_MONITOR_DIR, sizeof(ast_config_AST_MONITOR_DIR) - 1, "%s/monitor", ast_config_AST_SPOOL_DIR);
-	ast_copy_string(ast_config_AST_VAR_DIR, AST_VAR_DIR, sizeof(ast_config_AST_VAR_DIR));
-	ast_copy_string(ast_config_AST_DATA_DIR, AST_DATA_DIR, sizeof(ast_config_AST_DATA_DIR));
-	ast_copy_string(ast_config_AST_LOG_DIR, AST_LOG_DIR, sizeof(ast_config_AST_LOG_DIR));
-	ast_copy_string(ast_config_AST_AGI_DIR, AST_AGI_DIR, sizeof(ast_config_AST_AGI_DIR));
-	ast_copy_string(ast_config_AST_DB, AST_DB, sizeof(ast_config_AST_DB));
-	ast_copy_string(ast_config_AST_KEY_DIR, AST_KEY_DIR, sizeof(ast_config_AST_KEY_DIR));
-	ast_copy_string(ast_config_AST_PID, AST_PID, sizeof(ast_config_AST_PID));
-	ast_copy_string(ast_config_AST_SOCKET, AST_SOCKET, sizeof(ast_config_AST_SOCKET));
-	ast_copy_string(ast_config_AST_RUN_DIR, AST_RUN_DIR, sizeof(ast_config_AST_RUN_DIR));
+	ast_copy_string(ast_config_AST_VAR_DIR, DEFAULT_VAR_DIR, sizeof(ast_config_AST_VAR_DIR));
+	ast_copy_string(ast_config_AST_DATA_DIR, DEFAULT_DATA_DIR, sizeof(ast_config_AST_DATA_DIR));
+	ast_copy_string(ast_config_AST_LOG_DIR, DEFAULT_LOG_DIR, sizeof(ast_config_AST_LOG_DIR));
+	ast_copy_string(ast_config_AST_AGI_DIR, DEFAULT_AGI_DIR, sizeof(ast_config_AST_AGI_DIR));
+	ast_copy_string(ast_config_AST_DB, DEFAULT_DB, sizeof(ast_config_AST_DB));
+	ast_copy_string(ast_config_AST_KEY_DIR, DEFAULT_KEY_DIR, sizeof(ast_config_AST_KEY_DIR));
+	ast_copy_string(ast_config_AST_PID, DEFAULT_PID, sizeof(ast_config_AST_PID));
+	ast_copy_string(ast_config_AST_SOCKET, DEFAULT_SOCKET, sizeof(ast_config_AST_SOCKET));
+	ast_copy_string(ast_config_AST_RUN_DIR, DEFAULT_RUN_DIR, sizeof(ast_config_AST_RUN_DIR));
 
 	/* no asterisk.conf? no problem, use buildtime config! */
 	if (!cfg) {




More information about the asterisk-commits mailing list