Include mem_alloc.h in files that use xmalloc

Also fix some incorrect calls exposed by this.
Forwarded: no
Last-Update: 2015-12-27

Gbp-Pq: Name declare-xmalloc.patch
This commit is contained in:
Colin Watson 2022-05-14 03:36:38 +08:00 committed by openKylinBot
parent e7b581b8f8
commit 27ee0dd761
4 changed files with 12 additions and 8 deletions

View File

@ -47,6 +47,7 @@
#include <string.h> #include <string.h>
#include <assert.h> #include <assert.h>
#include <time.h> #include <time.h>
#include <mem_alloc.h>
#include <options.h> #include <options.h>
#include <misc.h> #include <misc.h>
#include <epsilon.h> #include <epsilon.h>

View File

@ -47,6 +47,7 @@
#include <string.h> #include <string.h>
#include <assert.h> #include <assert.h>
#include <time.h> #include <time.h>
#include <mem_alloc.h>
#include <options.h> #include <options.h>
#include <misc.h> #include <misc.h>
#include <epsilon.h> #include <epsilon.h>

View File

@ -48,6 +48,7 @@
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <epsilon.h> #include <epsilon.h>
#include <mem_alloc.h>
#include <options.h> #include <options.h>
#include <misc.h> #include <misc.h>
@ -418,11 +419,11 @@ static void action_encode_gs(int sock_fd, char *ip_addr, int port)
filter[filter_len] = 0; filter[filter_len] = 0;
/* Allocate memory (it will be released implicitly at exit) */ /* Allocate memory (it will be released implicitly at exit) */
Y0 = (unsigned char *) xmalloc(block_size * block_size, Y0 = (unsigned char *) xmalloc(block_size * block_size *
sizeof(unsigned char)); sizeof(unsigned char));
Y = (unsigned char **) eps_malloc_2D(block_size, block_size, Y = (unsigned char **) eps_malloc_2D(block_size, block_size,
sizeof(unsigned char)); sizeof(unsigned char));
buf = (unsigned char *) xmalloc(bytes_per_block, buf = (unsigned char *) xmalloc(bytes_per_block *
sizeof(unsigned char)); sizeof(unsigned char));
/* Process all incoming blocks */ /* Process all incoming blocks */
@ -526,7 +527,7 @@ static void action_encode_tc(int sock_fd, char *ip_addr, int port)
RECV_VALUE_FROM_MASTER(&Cr_ratio); RECV_VALUE_FROM_MASTER(&Cr_ratio);
/* Allocate memory (it will be released implicitly at exit) */ /* Allocate memory (it will be released implicitly at exit) */
Y0 = (unsigned char *) xmalloc(block_size * block_size, Y0 = (unsigned char *) xmalloc(block_size * block_size *
sizeof(unsigned char)); sizeof(unsigned char));
R = (unsigned char **) eps_malloc_2D(block_size, block_size, R = (unsigned char **) eps_malloc_2D(block_size, block_size,
sizeof(unsigned char)); sizeof(unsigned char));
@ -534,7 +535,7 @@ static void action_encode_tc(int sock_fd, char *ip_addr, int port)
sizeof(unsigned char)); sizeof(unsigned char));
B = (unsigned char **) eps_malloc_2D(block_size, block_size, B = (unsigned char **) eps_malloc_2D(block_size, block_size,
sizeof(unsigned char)); sizeof(unsigned char));
buf = (unsigned char *) xmalloc(bytes_per_block, buf = (unsigned char *) xmalloc(bytes_per_block *
sizeof(unsigned char)); sizeof(unsigned char));
/* Process all incoming blocks */ /* Process all incoming blocks */
@ -628,11 +629,11 @@ static void action_decode_gs(int sock_fd, char *ip_addr, int port)
RECV_VALUE_FROM_MASTER(&block_size); RECV_VALUE_FROM_MASTER(&block_size);
/* Allocate memory (it will be released implicitly at exit) */ /* Allocate memory (it will be released implicitly at exit) */
Y0 = (unsigned char *) xmalloc(block_size * block_size, Y0 = (unsigned char *) xmalloc(block_size * block_size *
sizeof(unsigned char)); sizeof(unsigned char));
Y = (unsigned char **) eps_malloc_2D(block_size, block_size, Y = (unsigned char **) eps_malloc_2D(block_size, block_size,
sizeof(unsigned char)); sizeof(unsigned char));
buf = (unsigned char *) xmalloc(buf_size, buf = (unsigned char *) xmalloc(buf_size *
sizeof(unsigned char)); sizeof(unsigned char));
/* Process all incoming blocks */ /* Process all incoming blocks */
@ -707,7 +708,7 @@ static void action_decode_tc(int sock_fd, char *ip_addr, int port)
RECV_VALUE_FROM_MASTER(&block_size); RECV_VALUE_FROM_MASTER(&block_size);
/* Allocate memory (it will be released implicitly at exit) */ /* Allocate memory (it will be released implicitly at exit) */
Y0 = (unsigned char *) xmalloc(block_size * block_size, Y0 = (unsigned char *) xmalloc(block_size * block_size *
sizeof(unsigned char)); sizeof(unsigned char));
R = (unsigned char **) eps_malloc_2D(block_size, block_size, R = (unsigned char **) eps_malloc_2D(block_size, block_size,
sizeof(unsigned char)); sizeof(unsigned char));
@ -715,7 +716,7 @@ static void action_decode_tc(int sock_fd, char *ip_addr, int port)
sizeof(unsigned char)); sizeof(unsigned char));
B = (unsigned char **) eps_malloc_2D(block_size, block_size, B = (unsigned char **) eps_malloc_2D(block_size, block_size,
sizeof(unsigned char)); sizeof(unsigned char));
buf = (unsigned char *) xmalloc(buf_size, buf = (unsigned char *) xmalloc(buf_size *
sizeof(unsigned char)); sizeof(unsigned char));
/* Process all incoming blocks */ /* Process all incoming blocks */

View File

@ -31,6 +31,7 @@
#include <mpi.h> #include <mpi.h>
#include <worker_mpi_node.h> #include <worker_mpi_node.h>
#include <epsilon.h> #include <epsilon.h>
#include <mem_alloc.h>
#include <misc.h> #include <misc.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>