[asterisk-commits] kpfleming: trunk r44391 - in /trunk: ./ include/asterisk.h main/utils.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Oct 4 14:10:37 MST 2006


Author: kpfleming
Date: Wed Oct  4 16:10:36 2006
New Revision: 44391

URL: http://svn.digium.com/view/asterisk?rev=44391&view=rev
Log:
Merged revisions 44390 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r44390 | kpfleming | 2006-10-04 16:04:21 -0500 (Wed, 04 Oct 2006) | 2 lines

make LOW_MEMORY builds actually work

........

Modified:
    trunk/   (props changed)
    trunk/include/asterisk.h
    trunk/main/utils.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/include/asterisk.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk.h?rev=44391&r1=44390&r2=44391&view=diff
==============================================================================
--- trunk/include/asterisk.h (original)
+++ trunk/include/asterisk.h Wed Oct  4 16:10:36 2006
@@ -101,6 +101,7 @@
  */
 void ast_unregister_atexit(void (*func)(void));
 
+#if !defined(LOW_MEMORY)
 /*!
  * \brief Register the version of a source code file with the core.
  * \param file the source file name
@@ -123,6 +124,56 @@
  */
 void ast_unregister_file_version(const char *file);
 
+/*!
+ * \brief Register/unregister a source code file with the core.
+ * \param file the source file name
+ * \param version the version string (typically a CVS revision keyword string)
+ *
+ * This macro will place a file-scope constructor and destructor into the
+ * source of the module using it; this will cause the version of this file
+ * to registered with the Asterisk core (and unregistered) at the appropriate
+ * times.
+ *
+ * Example:
+ *
+ * \code
+ * ASTERISK_FILE_VERSION(__FILE__, "\$Revision\$")
+ * \endcode
+ *
+ * \note The dollar signs above have been protected with backslashes to keep
+ * CVS from modifying them in this file; under normal circumstances they would
+ * not be present and CVS would expand the Revision keyword into the file's
+ * revision number.
+ */
+#ifdef MTX_PROFILE
+#define	HAVE_MTX_PROFILE	/* used in lock.h */
+#define ASTERISK_FILE_VERSION(file, version) \
+	static int mtx_prof = -1;       /* profile mutex */	\
+	static void __attribute__((constructor)) __register_file_version(void) \
+	{ \
+		mtx_prof = ast_add_profile("mtx_lock_" file, 0);	\
+		ast_register_file_version(file, version); \
+	} \
+	static void __attribute__((destructor)) __unregister_file_version(void) \
+	{ \
+		ast_unregister_file_version(file); \
+	}
+#else /* !MTX_PROFILE */
+#define ASTERISK_FILE_VERSION(file, version) \
+	static void __attribute__((constructor)) __register_file_version(void) \
+	{ \
+		ast_register_file_version(file, version); \
+	} \
+	static void __attribute__((destructor)) __unregister_file_version(void) \
+	{ \
+		ast_unregister_file_version(file); \
+	}
+#endif /* !MTX_PROFILE */
+#else /* LOW_MEMORY */
+#define ASTERISK_FILE_VERSION(file, x)
+#endif /* LOW_MEMORY */
+
+#if !defined(LOW_MEMORY)
 /*!
  * \brief support for event profiling
  *
@@ -141,57 +192,10 @@
 int ast_add_profile(const char *, uint64_t scale);
 int64_t ast_profile(int, int64_t);
 int64_t ast_mark(int, int start1_stop0);
-
-/*!
- * \brief Register/unregister a source code file with the core.
- * \param file the source file name
- * \param version the version string (typically a CVS revision keyword string)
- *
- * This macro will place a file-scope constructor and destructor into the
- * source of the module using it; this will cause the version of this file
- * to registered with the Asterisk core (and unregistered) at the appropriate
- * times.
- *
- * Example:
- *
- * \code
- * ASTERISK_FILE_VERSION(__FILE__, "\$Revision\$")
- * \endcode
- *
- * \note The dollar signs above have been protected with backslashes to keep
- * CVS from modifying them in this file; under normal circumstances they would
- * not be present and CVS would expand the Revision keyword into the file's
- * revision number.
- */
-#if defined(__GNUC__) && !defined(LOW_MEMORY)
-#ifdef MTX_PROFILE
-#define	HAVE_MTX_PROFILE	/* used in lock.h */
-#define ASTERISK_FILE_VERSION(file, version) \
-	static int mtx_prof = -1;       /* profile mutex */	\
-	static void __attribute__((constructor)) __register_file_version(void) \
-	{ \
-		mtx_prof = ast_add_profile("mtx_lock_" file, 0);	\
-		ast_register_file_version(file, version); \
-	} \
-	static void __attribute__((destructor)) __unregister_file_version(void) \
-	{ \
-		ast_unregister_file_version(file); \
-	}
-#else
-#define ASTERISK_FILE_VERSION(file, version) \
-	static void __attribute__((constructor)) __register_file_version(void) \
-	{ \
-		ast_register_file_version(file, version); \
-	} \
-	static void __attribute__((destructor)) __unregister_file_version(void) \
-	{ \
-		ast_unregister_file_version(file); \
-	}
-#endif
-#elif !defined(LOW_MEMORY) /* ! __GNUC__  && ! LOW_MEMORY*/
-#define ASTERISK_FILE_VERSION(file, x) static const char __file_version[] = x;
 #else /* LOW_MEMORY */
-#define ASTERISK_FILE_VERSION(file, x)
-#endif /* __GNUC__ */
+#define ast_add_profile(a, b) 0
+#define ast_profile(a, b) do { } while (0)
+#define ast_mark(a, b) do { } while (0)
+#endif /* LOW_MEMORY */
 
 #endif /* _ASTERISK_H */

Modified: trunk/main/utils.c
URL: http://svn.digium.com/view/asterisk/trunk/main/utils.c?rev=44391&r1=44390&r2=44391&view=diff
==============================================================================
--- trunk/main/utils.c (original)
+++ trunk/main/utils.c Wed Oct  4 16:10:36 2006
@@ -509,6 +509,7 @@
 #undef pthread_create /* For ast_pthread_create function only */
 #endif /* !__linux__ */
 
+#if !defined(LOW_MEMORY)
 /*
  * support for 'show threads'. The start routine is wrapped by
  * dummy_start(), so that ast_register_thread() and
@@ -546,11 +547,15 @@
 	return ret;
 }
 
+#endif /* !LOW_MEMORY */
+
 int ast_pthread_create_stack(pthread_t *thread, pthread_attr_t *attr, void *(*start_routine)(void *),
 			     void *data, size_t stacksize, const char *file, const char *caller,
 			     int line, const char *start_fn)
 {
+#if !defined(LOW_MEMORY)
 	struct thr_arg *a;
+#endif
 
 	if (!attr) {
 		attr = alloca(sizeof(*attr));
@@ -575,6 +580,7 @@
 	if ((errno = pthread_attr_setstacksize(attr, stacksize ? stacksize : AST_STACKSIZE)))
 		ast_log(LOG_WARNING, "pthread_attr_setstacksize: %s\n", strerror(errno));
 
+#if !defined(LOW_MEMORY)
 	if ((a = ast_malloc(sizeof(*a)))) {
 		a->start_routine = start_routine;
 		a->data = data;
@@ -583,6 +589,7 @@
 			 start_fn, line, file, caller);
 		data = a;
 	}
+#endif /* !LOW_MEMORY */
 
 	return pthread_create(thread, attr, start_routine, data); /* We're in ast_pthread_create, so it's okay */
 }



More information about the asterisk-commits mailing list