summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-04-28 23:23:24 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:51:44 -0500
commit522f9ace1446e360ba84ed3cbe6cdb15946cc6c3 (patch)
tree94cd008f74575581a45b55dec89f7273ccc75e43 /source4/lib
parent6736106581bd962b26cc2d903a9bb681a4a96d56 (diff)
downloadsamba-522f9ace1446e360ba84ed3cbe6cdb15946cc6c3.tar.gz
samba-522f9ace1446e360ba84ed3cbe6cdb15946cc6c3.tar.bz2
samba-522f9ace1446e360ba84ed3cbe6cdb15946cc6c3.zip
r22563: As tridge requested remove the _strict calls - for Samba3 I'm moving
to a separate file. Jeremy. (This used to be commit 80706cf98d31593a899652acb2cdedaa8bf3dfab)
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/talloc/talloc.c89
-rw-r--r--source4/lib/talloc/talloc.h16
2 files changed, 0 insertions, 105 deletions
diff --git a/source4/lib/talloc/talloc.c b/source4/lib/talloc/talloc.c
index 8f7906d0d8..b2b00d8c65 100644
--- a/source4/lib/talloc/talloc.c
+++ b/source4/lib/talloc/talloc.c
@@ -1086,29 +1086,6 @@ void *_talloc_zero(const void *ctx, size_t size, const char *name)
return p;
}
-
-/*
- talloc and zero memory.
- Strict version - returns NULL if size is zero.
-*/
-void *_talloc_zero_strict(const void *ctx, size_t size, const char *name)
-{
- void *p;
-
- if (unlikely(size == 0)) {
- return NULL;
- }
-
- p = _talloc_named_const(ctx, size, name);
-
- if (p) {
- memset(p, '\0', size);
- }
-
- return p;
-}
-
-
/*
memdup with a talloc.
*/
@@ -1124,26 +1101,6 @@ void *_talloc_memdup(const void *t, const void *p, size_t size, const char *name
}
/*
- memdup with a talloc.
- Strict version - returns NULL if size is zero.
-*/
-void *_talloc_memdup_strict(const void *t, const void *p, size_t size, const char *name)
-{
- void *newp;
-
- if (unlikely(size == 0)) {
- return NULL;
- }
-
- newp = _talloc_named_const(t, size, name);
- if (likely(newp)) {
- memcpy(newp, p, size);
- }
-
- return newp;
-}
-
-/*
strdup with a talloc
*/
char *talloc_strdup(const void *t, const char *p)
@@ -1324,23 +1281,6 @@ void *_talloc_array(const void *ctx, size_t el_size, unsigned count, const char
}
/*
- alloc an array, checking for integer overflow in the array size.
- Strict version - returns NULL if count or el_size are zero.
-*/
-void *_talloc_array_strict(const void *ctx, size_t el_size, unsigned count, const char *name)
-{
- if (count >= MAX_TALLOC_SIZE/el_size) {
- return NULL;
- }
-
- if (el_size == 0 || count == 0) {
- return NULL;
- }
-
- return _talloc_named_const(ctx, el_size * count, name);
-}
-
-/*
alloc an zero array, checking for integer overflow in the array size
*/
void *_talloc_zero_array(const void *ctx, size_t el_size, unsigned count, const char *name)
@@ -1352,24 +1292,6 @@ void *_talloc_zero_array(const void *ctx, size_t el_size, unsigned count, const
}
/*
- alloc an zero array, checking for integer overflow in the array size
- Strict version - returns NULL if count or el_size are zero.
-*/
-void *_talloc_zero_array_strict(const void *ctx, size_t el_size, unsigned count, const char *name)
-{
- if (count >= MAX_TALLOC_SIZE/el_size) {
- return NULL;
- }
-
- if (el_size == 0 || count == 0) {
- return NULL;
- }
-
- return _talloc_zero(ctx, el_size * count, name);
-}
-
-
-/*
realloc an array, checking for integer overflow in the array size
*/
void *_talloc_realloc_array(const void *ctx, void *ptr, size_t el_size, unsigned count, const char *name)
@@ -1497,14 +1419,3 @@ int talloc_is_parent(const void *context, const void *ptr)
}
return 0;
}
-
-/*
- Talloc wrapper that returns NULL if size == 0.
-*/
-void *talloc_strict(const void *context, size_t size, const char *name)
-{
- if (unlikely(size == 0)) {
- return NULL;
- }
- return _talloc_named_const(context, size, name);
-}
diff --git a/source4/lib/talloc/talloc.h b/source4/lib/talloc/talloc.h
index 48bf4303c6..d9e7d94338 100644
--- a/source4/lib/talloc/talloc.h
+++ b/source4/lib/talloc/talloc.h
@@ -84,33 +84,22 @@ typedef void TALLOC_CTX;
/* useful macros for creating type checked pointers */
#define talloc(ctx, type) (type *)talloc_named_const(ctx, sizeof(type), #type)
#define talloc_size(ctx, size) talloc_named_const(ctx, size, __location__)
-#define talloc_size_strict(ctx, size) talloc_strict(ctx, size, __location__)
#define talloc_ptrtype(ctx, ptr) (_TALLOC_TYPEOF(ptr))talloc_size(ctx, sizeof(*(ptr)))
#define talloc_new(ctx) talloc_named_const(ctx, 0, "talloc_new: " __location__)
#define talloc_zero(ctx, type) (type *)_talloc_zero(ctx, sizeof(type), #type)
-/* Varient of talloc_zero that returns NULL if size is zero. */
-#define talloc_zero_strict(ctx, type) (type *)_talloc_zero_strict(ctx, sizeof(type), #type)
#define talloc_zero_size(ctx, size) _talloc_zero(ctx, size, __location__)
-#define talloc_zero_size_strict(ctx, size) _talloc_zero_strict(ctx, size, __location__)
#define talloc_zero_array(ctx, type, count) (type *)_talloc_zero_array(ctx, sizeof(type), count, #type)
-/* Varient of talloc_zero_array that returns NULL if count is zero. */
-#define talloc_zero_array_strict(ctx, type, count) (type *)_talloc_zero_array_strict(ctx, sizeof(type), count, #type)
#define talloc_array(ctx, type, count) (type *)_talloc_array(ctx, sizeof(type), count, #type)
-/* Varient of talloc_array that returns NULL if count is zero. */
-#define talloc_array_strict(ctx, type, count) (type *)_talloc_array_strict(ctx, sizeof(type), count, #type)
#define talloc_array_size(ctx, size, count) _talloc_array(ctx, size, count, __location__)
-#define talloc_array_size_strict(ctx, size, count) _talloc_array_strict(ctx, size, count, __location__)
#define talloc_array_ptrtype(ctx, ptr, count) (_TALLOC_TYPEOF(ptr))talloc_array_size(ctx, sizeof(*(ptr)), count)
#define talloc_realloc(ctx, p, type, count) (type *)_talloc_realloc_array(ctx, p, sizeof(type), count, #type)
#define talloc_realloc_size(ctx, ptr, size) _talloc_realloc(ctx, ptr, size, __location__)
#define talloc_memdup(t, p, size) _talloc_memdup(t, p, size, __location__)
-/* Varient of talloc_memdup that returns NULL if count is zero. */
-#define talloc_memdup_strict(t, p, size) _talloc_memdup_strict(t, p, size, __location__)
#define talloc_set_type(ptr, type) talloc_set_name_const(ptr, #type)
#define talloc_get_type(ptr, type) (type *)talloc_check_name(ptr, #type)
@@ -163,9 +152,7 @@ void talloc_disable_null_tracking(void);
void talloc_enable_leak_report(void);
void talloc_enable_leak_report_full(void);
void *_talloc_zero(const void *ctx, size_t size, const char *name);
-void *_talloc_zero_strict(const void *ctx, size_t size, const char *name);
void *_talloc_memdup(const void *t, const void *p, size_t size, const char *name);
-void *_talloc_memdup_strict(const void *t, const void *p, size_t size, const char *name);
char *talloc_strdup(const void *t, const char *p);
char *talloc_strndup(const void *t, const char *p, size_t n);
char *talloc_append_string(const void *t, char *orig, const char *append);
@@ -174,9 +161,7 @@ char *talloc_vasprintf_append(char *s, const char *fmt, va_list ap) PRINTF_ATTRI
char *talloc_asprintf(const void *t, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3);
char *talloc_asprintf_append(char *s, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3);
void *_talloc_array(const void *ctx, size_t el_size, unsigned count, const char *name);
-void *_talloc_array_strict(const void *ctx, size_t el_size, unsigned count, const char *name);
void *_talloc_zero_array(const void *ctx, size_t el_size, unsigned count, const char *name);
-void *_talloc_zero_array_strict(const void *ctx, size_t el_size, unsigned count, const char *name);
void *_talloc_realloc_array(const void *ctx, void *ptr, size_t el_size, unsigned count, const char *name);
void *talloc_realloc_fn(const void *context, void *ptr, size_t size);
void *talloc_autofree_context(void);
@@ -184,6 +169,5 @@ size_t talloc_get_size(const void *ctx);
void *talloc_find_parent_byname(const void *ctx, const char *name);
void talloc_show_parents(const void *context, FILE *file);
int talloc_is_parent(const void *context, const void *ptr);
-void *talloc_strict(const void *context, size_t size, const char *name);
#endif