[asterisk-commits] mmichelson: branch group/asterisk-cpp r168393 - in /team/group/asterisk-cpp: ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Jan 10 17:37:55 CST 2009


Author: mmichelson
Date: Sat Jan 10 17:37:55 2009
New Revision: 168393

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=168393
Log:
astmm.c compiles

Okay, so I didn't stop for the day. I lied.
So sue me.


Modified:
    team/group/asterisk-cpp/include/asterisk/unaligned.h
    team/group/asterisk-cpp/main/astmm.c

Modified: team/group/asterisk-cpp/include/asterisk/unaligned.h
URL: http://svn.digium.com/svn-view/asterisk/team/group/asterisk-cpp/include/asterisk/unaligned.h?view=diff&rev=168393&r1=168392&r2=168393
==============================================================================
--- team/group/asterisk-cpp/include/asterisk/unaligned.h (original)
+++ team/group/asterisk-cpp/include/asterisk/unaligned.h Sat Jan 10 17:37:55 2009
@@ -27,27 +27,27 @@
 /* If we just tell GCC what's going on, we can trust it to behave optimally */
 static inline unsigned int get_unaligned_uint32(const void *p)
 {
-	const struct { unsigned int d; } __attribute__((packed)) *pp = p;
+	const struct dummy_struct { unsigned int d; } __attribute__((packed)) *pp = (struct dummy_struct *) p;
 
 	return pp->d;
 }
 static inline unsigned short get_unaligned_uint16(const void *p)
 {
-	const struct { unsigned short d; } __attribute__((packed)) *pp = p;
+	const struct dummy_struct { unsigned short d; } __attribute__((packed)) *pp = (struct dummy_struct *) p;
 
 	return pp->d;
 }
 
 static inline void put_unaligned_uint32(void *p, unsigned int datum)
 {
-	struct { unsigned int d; } __attribute__((packed)) *pp = p;
+	struct dummy_struct { unsigned int d; } __attribute__((packed)) *pp = (struct dummy_struct *) p;
 
 	pp->d = datum;
 }
 
 static inline void put_unaligned_uint16(void *p, unsigned short datum)
 {
-	struct { unsigned short d; } __attribute__((packed)) *pp = p;
+	struct dummy_struct { unsigned short d; } __attribute__((packed)) *pp = (struct dummy_struct *) p;
 
 	pp->d = datum;
 }

Modified: team/group/asterisk-cpp/main/astmm.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/asterisk-cpp/main/astmm.c?view=diff&rev=168393&r1=168392&r2=168393
==============================================================================
--- team/group/asterisk-cpp/main/astmm.c (original)
+++ team/group/asterisk-cpp/main/astmm.c Sat Jan 10 17:37:55 2009
@@ -111,7 +111,7 @@
 	unsigned int *fence;
 	int hash;
 
-	if (!(reg = malloc(size + sizeof(*reg) + sizeof(*fence)))) {
+	if (!(reg = (struct ast_region *) malloc(size + sizeof(*reg) + sizeof(*fence)))) {
 		astmm_log("Memory Allocation Failure - '%d' bytes in function %s "
 			  "at line %d of %s\n", (int) size, func, lineno, file);
 		return NULL;
@@ -126,7 +126,7 @@
 	ptr = reg->data;
 	hash = HASH(ptr);
 	reg->fence = FENCE_MAGIC;
-	fence = (ptr + reg->len);
+	fence = (unsigned int *) ((char *)ptr + reg->len);
 	put_unaligned_uint32(fence, FENCE_MAGIC);
 
 	ast_mutex_lock(&reglock);
@@ -253,13 +253,13 @@
 char *__ast_strdup(const char *s, const char *file, int lineno, const char *func) 
 {
 	size_t len;
-	void *ptr;
+	char *ptr;
 
 	if (!s)
 		return NULL;
 
 	len = strlen(s) + 1;
-	if ((ptr = __ast_alloc_region(len, FUNC_STRDUP, file, lineno, func, 0)))
+	if ((ptr = (char *) __ast_alloc_region(len, FUNC_STRDUP, file, lineno, func, 0)))
 		strcpy(ptr, s);
 
 	return ptr;
@@ -268,7 +268,7 @@
 char *__ast_strndup(const char *s, size_t n, const char *file, int lineno, const char *func) 
 {
 	size_t len;
-	void *ptr;
+	char *ptr;
 
 	if (!s)
 		return NULL;
@@ -276,7 +276,7 @@
 	len = strlen(s) + 1;
 	if (len > n)
 		len = n;
-	if ((ptr = __ast_alloc_region(len, FUNC_STRNDUP, file, lineno, func, 0)))
+	if ((ptr = (char *) __ast_alloc_region(len, FUNC_STRNDUP, file, lineno, func, 0)))
 		strcpy(ptr, s);
 
 	return ptr;
@@ -293,7 +293,7 @@
 	va_copy(ap2, ap);
 	size = vsnprintf(&s, 1, fmt, ap2);
 	va_end(ap2);
-	if (!(*strp = __ast_alloc_region(size + 1, FUNC_ASPRINTF, file, lineno, func, 0))) {
+	if (!(*strp = (char *)__ast_alloc_region(size + 1, FUNC_ASPRINTF, file, lineno, func, 0))) {
 		va_end(ap);
 		return -1;
 	}
@@ -313,7 +313,7 @@
 	va_copy(ap2, ap);
 	size = vsnprintf(&s, 1, fmt, ap2);
 	va_end(ap2);
-	if (!(*strp = __ast_alloc_region(size + 1, FUNC_VASPRINTF, file, lineno, func, 0))) {
+	if (!(*strp = (char *) __ast_alloc_region(size + 1, FUNC_VASPRINTF, file, lineno, func, 0))) {
 		va_end(ap);
 		return -1;
 	}
@@ -426,7 +426,7 @@
 					break;
 			}
 			if (!cur) {
-				cur = alloca(sizeof(*cur));
+				cur = (struct file_summary *) alloca(sizeof(*cur));
 				memset(cur, 0, sizeof(*cur));
 				ast_copy_string(cur->fn, fn ? reg->func : reg->file, sizeof(cur->fn));
 				cur->next = list;
@@ -474,8 +474,8 @@
 }
 
 static struct ast_cli_entry cli_memory[] = {
-	AST_CLI_DEFINE(handle_memory_show, "Display outstanding memory allocations"),
-	AST_CLI_DEFINE(handle_memory_show_summary, "Summarize outstanding memory allocations"),
+	ast_cli_entry(handle_memory_show, "Display outstanding memory allocations"),
+	ast_cli_entry(handle_memory_show_summary, "Summarize outstanding memory allocations"),
 };
 
 void __ast_mm_init(void)




More information about the asterisk-commits mailing list