Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
af0b2207
Commit
af0b2207
authored
Nov 14, 2012
by
antirez
Browse files
zmalloc: kill unused __size parameter in update_zmalloc_stat_alloc() macro.
parent
a779b7e9
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/zmalloc.c
View file @
af0b2207
...
...
@@ -85,7 +85,7 @@ void zlibc_free(void *ptr) {
#endif
#define update_zmalloc_stat_alloc(__n
,__size
) do { \
#define update_zmalloc_stat_alloc(__n) do { \
size_t _n = (__n); \
if (_n&(sizeof(long)-1)) _n += sizeof(long)-(_n&(sizeof(long)-1)); \
if (zmalloc_thread_safe) { \
...
...
@@ -123,11 +123,11 @@ void *zmalloc(size_t size) {
if
(
!
ptr
)
zmalloc_oom_handler
(
size
);
#ifdef HAVE_MALLOC_SIZE
update_zmalloc_stat_alloc
(
zmalloc_size
(
ptr
)
,
size
);
update_zmalloc_stat_alloc
(
zmalloc_size
(
ptr
));
return
ptr
;
#else
*
((
size_t
*
)
ptr
)
=
size
;
update_zmalloc_stat_alloc
(
size
+
PREFIX_SIZE
,
size
);
update_zmalloc_stat_alloc
(
size
+
PREFIX_SIZE
);
return
(
char
*
)
ptr
+
PREFIX_SIZE
;
#endif
}
...
...
@@ -137,11 +137,11 @@ void *zcalloc(size_t size) {
if
(
!
ptr
)
zmalloc_oom_handler
(
size
);
#ifdef HAVE_MALLOC_SIZE
update_zmalloc_stat_alloc
(
zmalloc_size
(
ptr
)
,
size
);
update_zmalloc_stat_alloc
(
zmalloc_size
(
ptr
));
return
ptr
;
#else
*
((
size_t
*
)
ptr
)
=
size
;
update_zmalloc_stat_alloc
(
size
+
PREFIX_SIZE
,
size
);
update_zmalloc_stat_alloc
(
size
+
PREFIX_SIZE
);
return
(
char
*
)
ptr
+
PREFIX_SIZE
;
#endif
}
...
...
@@ -160,7 +160,7 @@ void *zrealloc(void *ptr, size_t size) {
if
(
!
newptr
)
zmalloc_oom_handler
(
size
);
update_zmalloc_stat_free
(
oldsize
);
update_zmalloc_stat_alloc
(
zmalloc_size
(
newptr
)
,
size
);
update_zmalloc_stat_alloc
(
zmalloc_size
(
newptr
));
return
newptr
;
#else
realptr
=
(
char
*
)
ptr
-
PREFIX_SIZE
;
...
...
@@ -170,7 +170,7 @@ void *zrealloc(void *ptr, size_t size) {
*
((
size_t
*
)
newptr
)
=
size
;
update_zmalloc_stat_free
(
oldsize
);
update_zmalloc_stat_alloc
(
size
,
size
);
update_zmalloc_stat_alloc
(
size
);
return
(
char
*
)
newptr
+
PREFIX_SIZE
;
#endif
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment