summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorHolger Lubitz2007-08-23 23:15:54 +0200
committerHolger Lubitz2007-08-23 23:15:54 +0200
commit5d6f6fb9243aca7f62f85919519a584836302c99 (patch)
tree26a81eeaf56272b45d6c58c12999151abc3bbd84 /src/include
parent__nonnull changes (diff)
parentMerge branch 'master' of git://git.etherboot.org/scm/gpxe (diff)
downloadipxe-5d6f6fb9243aca7f62f85919519a584836302c99.tar.gz
ipxe-5d6f6fb9243aca7f62f85919519a584836302c99.tar.xz
ipxe-5d6f6fb9243aca7f62f85919519a584836302c99.zip
Merge branch 'master' into curses
Conflicts: src/include/compiler.h src/include/readline/readline.h created by strings branch merge. resolved.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/compiler.h6
-rw-r--r--src/include/gpxe/dhcp.h2
-rw-r--r--src/include/gpxe/iobuf.h2
-rw-r--r--src/include/gpxe/malloc.h4
-rw-r--r--src/include/readline/readline.h2
-rw-r--r--src/include/stdlib.h6
-rw-r--r--src/include/string.h54
7 files changed, 41 insertions, 35 deletions
diff --git a/src/include/compiler.h b/src/include/compiler.h
index d680ae89e..a195e5368 100644
--- a/src/include/compiler.h
+++ b/src/include/compiler.h
@@ -299,6 +299,12 @@ extern void dbg_hex_dump_da ( unsigned long dispaddr,
#define __nonnull __attribute__ (( nonnull ))
/**
+ * Declare a pointer returned by a function as a unique memory address
+ * as returned by malloc-type functions.
+ */
+#define __malloc __attribute__ (( malloc ))
+
+/**
* Declare a function as used.
*
* Necessary only if the function is called only from assembler code.
diff --git a/src/include/gpxe/dhcp.h b/src/include/gpxe/dhcp.h
index bbd345c8b..43bccf185 100644
--- a/src/include/gpxe/dhcp.h
+++ b/src/include/gpxe/dhcp.h
@@ -507,7 +507,7 @@ extern void register_dhcp_options ( struct dhcp_option_block *options );
extern void unregister_dhcp_options ( struct dhcp_option_block *options );
extern void init_dhcp_options ( struct dhcp_option_block *options,
void *data, size_t max_len );
-extern struct dhcp_option_block * alloc_dhcp_options ( size_t max_len );
+extern struct dhcp_option_block * __malloc alloc_dhcp_options ( size_t max_len );
extern struct dhcp_option *
set_dhcp_option ( struct dhcp_option_block *options, unsigned int tag,
const void *data, size_t len );
diff --git a/src/include/gpxe/iobuf.h b/src/include/gpxe/iobuf.h
index c0dfd434d..e3db01ac2 100644
--- a/src/include/gpxe/iobuf.h
+++ b/src/include/gpxe/iobuf.h
@@ -161,7 +161,7 @@ static inline size_t iob_tailroom ( struct io_buffer *iobuf ) {
return ( iobuf->end - iobuf->tail );
}
-extern struct io_buffer * alloc_iob ( size_t len );
+extern struct io_buffer * __malloc alloc_iob ( size_t len );
extern void free_iob ( struct io_buffer *iobuf );
extern void iob_pad ( struct io_buffer *iobuf, size_t min_len );
extern int iob_ensure_headroom ( struct io_buffer *iobuf, size_t len );
diff --git a/src/include/gpxe/malloc.h b/src/include/gpxe/malloc.h
index 0e18f6a35..cce5d1d34 100644
--- a/src/include/gpxe/malloc.h
+++ b/src/include/gpxe/malloc.h
@@ -19,7 +19,7 @@
extern size_t freemem;
-extern void * alloc_memblock ( size_t size, size_t align );
+extern void * __malloc alloc_memblock ( size_t size, size_t align );
extern void free_memblock ( void *ptr, size_t size );
extern void mpopulate ( void *start, size_t len );
extern void mdumpfree ( void );
@@ -35,7 +35,7 @@ extern void mdumpfree ( void );
*
* @c align must be a power of two. @c size may not be zero.
*/
-static inline void * malloc_dma ( size_t size, size_t phys_align ) {
+static inline void * __malloc malloc_dma ( size_t size, size_t phys_align ) {
return alloc_memblock ( size, phys_align );
}
diff --git a/src/include/readline/readline.h b/src/include/readline/readline.h
index 791231307..1a03b4836 100644
--- a/src/include/readline/readline.h
+++ b/src/include/readline/readline.h
@@ -7,6 +7,6 @@
*
*/
-extern char * readline ( const char *prompt ) __nonnull;
+extern char * __malloc readline ( const char *prompt );
#endif /* _READLINE_H */
diff --git a/src/include/stdlib.h b/src/include/stdlib.h
index 5c8fc3df4..ae9969622 100644
--- a/src/include/stdlib.h
+++ b/src/include/stdlib.h
@@ -20,10 +20,10 @@ extern unsigned long strtoul ( const char *p, char **endp, int base );
****************************************************************************
*/
-extern void * malloc ( size_t size );
+extern void * __malloc malloc ( size_t size );
extern void * realloc ( void *old_ptr, size_t new_size );
extern void free ( void *ptr );
-extern void * zalloc ( size_t len );
+extern void * __malloc zalloc ( size_t len );
/**
* Allocate cleared memory
@@ -38,7 +38,7 @@ extern void * zalloc ( size_t len );
* function in zalloc(), since in most cases @c nmemb will be 1 and
* doing the multiply is just wasteful.
*/
-static inline void * calloc ( size_t nmemb, size_t size ) {
+static inline void * __malloc calloc ( size_t nmemb, size_t size ) {
return zalloc ( nmemb * size );
}
diff --git a/src/include/string.h b/src/include/string.h
index 1d104c524..a2894a3a3 100644
--- a/src/include/string.h
+++ b/src/include/string.h
@@ -17,33 +17,33 @@
#include <stddef.h>
#include <bits/string.h>
-int strnicmp(const char *s1, const char *s2, size_t len);
-char * strcpy(char * dest,const char *src);
-char * strncpy(char * dest,const char *src,size_t count);
-char * strcat(char * dest, const char * src);
-char * strncat(char *dest, const char *src, size_t count);
-int __attribute__ (( pure )) strcmp(const char * cs,const char * ct);
-int __attribute__ (( pure )) strncmp(const char * cs,const char * ct,
- size_t count);
-char * strchr(const char * s, int c);
-char * strrchr(const char * s, int c);
-size_t strlen(const char * s);
-size_t strnlen(const char * s, size_t count);
-size_t strspn(const char *s, const char *accept);
-size_t strcspn(const char *s, const char *reject);
-char * strpbrk(const char * cs,const char * ct);
-char * strtok(char * s,const char * ct);
-char * strsep(char **s, const char *ct);
-void * memset(void * s,int c,size_t count);
-void * memmove(void * dest,const void *src,size_t count);
-int __attribute__ (( pure )) memcmp(const void * cs,const void * ct,
- size_t count);
-void * memscan(void * addr, int c, size_t size);
-char * strstr(const char * s1,const char * s2);
-void * memchr(const void *s, int c, size_t n);
-char * strdup(const char *s);
-char * strndup(const char *s, size_t n);
+int __pure strnicmp(const char *s1, const char *s2, size_t len) __nonnull;
+char * strcpy(char * dest,const char *src) __nonnull;
+char * strncpy(char * dest,const char *src,size_t count) __nonnull;
+char * strcat(char * dest, const char * src) __nonnull;
+char * strncat(char *dest, const char *src, size_t count) __nonnull;
+int __pure strcmp(const char * cs,const char * ct) __nonnull;
+int __pure strncmp(const char * cs,const char * ct,
+ size_t count) __nonnull;
+char * __pure strchr(const char * s, int c) __nonnull;
+char * __pure strrchr(const char * s, int c) __nonnull;
+size_t __pure strlen(const char * s) __nonnull;
+size_t __pure strnlen(const char * s, size_t count) __nonnull;
+size_t __pure strspn(const char *s, const char *accept) __nonnull;
+size_t __pure strcspn(const char *s, const char *reject) __nonnull;
+char * __pure strpbrk(const char * cs,const char * ct) __nonnull;
+char * strtok(char * s,const char * ct) __nonnull;
+char * strsep(char **s, const char *ct) __nonnull;
+void * memset(void * s,int c,size_t count) __nonnull;
+void * memmove(void * dest,const void *src,size_t count) __nonnull;
+int __pure memcmp(const void * cs,const void * ct,
+ size_t count) __nonnull;
+void * __pure memscan(const void * addr, int c, size_t size) __nonnull;
+char * __pure strstr(const char * s1,const char * s2) __nonnull;
+void * __pure memchr(const void *s, int c, size_t n) __nonnull;
+char * __malloc strdup(const char *s) __nonnull;
+char * __malloc strndup(const char *s, size_t n) __nonnull;
-extern const char * strerror ( int errno );
+extern const char * __pure strerror ( int errno );
#endif /* ETHERBOOT_STRING */