Convert from LAM_MALLOC / LAM_FREE to regular malloc / free. When
memory debugging is enabled, there are magic defines to change from malloc / free to lam_malloc / free. This commit was SVN r673.
Этот коммит содержится в:
родитель
e1fb3b0db4
Коммит
413d87586d
@ -13,11 +13,4 @@
|
||||
#include "lam/types.h"
|
||||
#include "lam/constants.h"
|
||||
|
||||
#if LAM_ENABLE_MEM_ZERO
|
||||
#include <string.h>
|
||||
#define LAM_MEM_ZERO(foo) memset(&(foo), 0, sizeof(foo))
|
||||
#else
|
||||
#define LAM_MEM_ZERO(foo)
|
||||
#endif
|
||||
|
||||
#endif /* LAM_H */
|
||||
|
@ -132,7 +132,7 @@ static inline void lam_fh_remove_value_ptrkey(lam_fast_hash_t *htbl, void *key,
|
||||
{
|
||||
buckets[i].fhn_is_taken = false;
|
||||
buckets[i].fhn_value = 0;
|
||||
LAM_FREE(buckets[i].fhn_key.pval);
|
||||
free(buckets[i].fhn_key.pval);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -152,8 +152,7 @@ static inline int lam_fh_find_empty_bucket(lam_fast_hash_t *htbl, uint32_t hval,
|
||||
{
|
||||
/* create new array of buckets
|
||||
for collision */
|
||||
htbl->fh_nodes[hval] = (lam_fhnode_t *)LAM_MALLOC(sizeof(lam_fhnode_t)
|
||||
* BUCKET_ALLOC_SZ);
|
||||
htbl->fh_nodes[hval] = malloc(sizeof(lam_fhnode_t) * BUCKET_ALLOC_SZ);
|
||||
if ( !htbl->fh_nodes[hval] )
|
||||
return LAM_ERR_OUT_OF_RESOURCE;
|
||||
|
||||
@ -214,7 +213,7 @@ static inline int lam_fh_set_value_ptrkey(lam_fast_hash_t *htbl, void *val,
|
||||
/* ASSERT: we have an empty bucket */
|
||||
/* found empty bucket */
|
||||
buckets = htbl->fh_nodes[hval];
|
||||
buckets[bucket_idx].fhn_key.pval = LAM_MALLOC(keysize);
|
||||
buckets[bucket_idx].fhn_key.pval = malloc(keysize);
|
||||
if ( NULL == buckets[bucket_idx].fhn_key.pval )
|
||||
{
|
||||
return LAM_ERR_OUT_OF_RESOURCE;
|
||||
@ -338,7 +337,7 @@ int lam_fh_resize(lam_fast_hash_t *htbl, uint32_t size)
|
||||
sizeof(uint32_t) * power2_size);
|
||||
if ( 0 == htbl->fh_bucket_cnt )
|
||||
{
|
||||
LAM_FREE(htbl->fh_nodes);
|
||||
free(htbl->fh_nodes);
|
||||
return LAM_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
||||
@ -375,7 +374,7 @@ void lam_fh_remove_all(lam_fast_hash_t *htbl)
|
||||
buckets[j].fhn_is_taken = false;
|
||||
if ( true == buckets[j].fhn_using_key_ptr )
|
||||
{
|
||||
LAM_FREE(buckets[j].fhn_key.pval);
|
||||
free(buckets[j].fhn_key.pval);
|
||||
}
|
||||
}
|
||||
} /* end loop over htbl->fh_bucket_cnt[i]. */
|
||||
|
@ -89,7 +89,7 @@ void lam_obj_destroy(lam_object_t *obj);
|
||||
|
||||
static inline lam_object_t* lam_create_object(size_t size, lam_class_info_t* class_info)
|
||||
{
|
||||
lam_object_t *obj = (lam_object_t*)LAM_MALLOC(size);
|
||||
lam_object_t *obj = (lam_object_t *) malloc(size);
|
||||
if ( NULL != obj ) {
|
||||
obj->obj_class = class_info;
|
||||
obj->obj_class->cls_init(obj);
|
||||
@ -124,7 +124,7 @@ static inline void lam_obj_release(lam_object_t *obj)
|
||||
if ( fetchNadd(&obj->obj_refcnt, -1) == 1 )
|
||||
{
|
||||
obj->obj_class->cls_destroy(obj);
|
||||
LAM_FREE(obj);
|
||||
free(obj);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ int lam_free_list_grow(lam_free_list_t* flist, size_t num_elements)
|
||||
if (NULL != flist->fl_allocator)
|
||||
ptr = (unsigned char*)lam_allocator_alloc(flist->fl_allocator, num_elements * flist->fl_elem_size);
|
||||
else
|
||||
ptr = (unsigned char*)LAM_MALLOC(num_elements * flist->fl_elem_size);
|
||||
ptr = malloc(num_elements * flist->fl_elem_size);
|
||||
if(NULL == ptr)
|
||||
return LAM_ERR_TEMP_OUT_OF_RESOURCE;
|
||||
|
||||
|
@ -4,10 +4,23 @@
|
||||
|
||||
#include "lam_config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lam/mem/malloc.h"
|
||||
#include "lam/util/output.h"
|
||||
|
||||
|
||||
/*
|
||||
* Undefine "malloc" and "free"
|
||||
*/
|
||||
|
||||
#if defined(malloc)
|
||||
#undef malloc
|
||||
#endif
|
||||
#if defined(free)
|
||||
#undef free
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Public variables
|
||||
*/
|
||||
@ -35,19 +48,8 @@ static lam_output_stream_t malloc_stream = {
|
||||
false, false, NULL
|
||||
};
|
||||
|
||||
/**
|
||||
* Initialize malloc debug output.
|
||||
*
|
||||
* This function is invoked to setup a dedicated output stream for
|
||||
* malloc debug functions. It does \em not (currently) do anything
|
||||
* other than that (i.e., no internal accounting for tracking
|
||||
* malloc/free statements, etc.).
|
||||
*
|
||||
* It is invoked as part of lam_init(). Although this function is not
|
||||
* \em necessary for LAM_MALLOC() and LAM_FREE(), it is strong
|
||||
* recommended because no output messages -- regardless of the malloc
|
||||
* debug level set by lam_malloc_debug() -- will be displayed unless
|
||||
* this function is invoked first.
|
||||
/*
|
||||
* Initialize the malloc debug interface
|
||||
*/
|
||||
void lam_malloc_init(void)
|
||||
{
|
||||
@ -55,11 +57,8 @@ void lam_malloc_init(void)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Shut down malloc debug output.
|
||||
*
|
||||
* This function is invoked as part of lam_finalize() to shut down the
|
||||
* output stream for malloc debug messages.
|
||||
/*
|
||||
* Finalize the malloc debug interface
|
||||
*/
|
||||
void lam_malloc_finalize(void)
|
||||
{
|
||||
@ -69,3 +68,60 @@ void lam_malloc_finalize(void)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \internal
|
||||
*
|
||||
* Back-end error-checking malloc function for LAM (you should use the
|
||||
* LAM_MALLOC() macro instead of this function).
|
||||
*
|
||||
* @param size The number of bytes to allocate
|
||||
* @param file Typically the __FILE__ macro
|
||||
* @param line Typically the __LINE__ macro
|
||||
*
|
||||
* This function is only used when --enable-mem-debug was specified to
|
||||
* configure (or by default if you're building in a CVS checkout).
|
||||
*/
|
||||
void *lam_malloc(size_t size, char *file, int line)
|
||||
{
|
||||
void *addr;
|
||||
if (lam_malloc_debug_level > 1) {
|
||||
if (size <= 0) {
|
||||
lam_output(lam_malloc_output, "Request for %ld bytes (%s, %d)",
|
||||
(long) size, file, line);
|
||||
}
|
||||
}
|
||||
addr = malloc(size);
|
||||
if (lam_malloc_debug_level > 0) {
|
||||
if (NULL == addr) {
|
||||
lam_output(lam_malloc_output,
|
||||
"Request for %ld bytes failed (%s, %d)",
|
||||
(long) size, file, line);
|
||||
}
|
||||
}
|
||||
|
||||
return addr;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \internal
|
||||
*
|
||||
* Back-end error-checking free function for LAM (you should use
|
||||
* free() instead of this function).
|
||||
*
|
||||
* @param addr Address on the heap to free()
|
||||
* @param file Typically the __FILE__ macro
|
||||
* @param line Typically the __LINE__ macro
|
||||
*
|
||||
* This function is only used when --enable-mem-debug was specified to
|
||||
* configure (or by default if you're building in a CVS checkout).
|
||||
*/
|
||||
void lam_free(void *addr, char *file, int line)
|
||||
{
|
||||
if (lam_malloc_debug_level > 1 && NULL == addr) {
|
||||
lam_output(lam_malloc_output, "Invalid free (%s, %d)", file, line);
|
||||
} else {
|
||||
free(addr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,12 +7,15 @@
|
||||
#ifndef LAM_MALLOC_H
|
||||
#define LAM_MALLOC_H
|
||||
|
||||
#include "lam_config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lam/util/output.h"
|
||||
|
||||
/*
|
||||
* THIS FILE CANNOT INCLUDE ANY OTHER LAM HEADER FILES!!!
|
||||
*
|
||||
* It is included via <lam_config_bottom.h>. Hence, it should not
|
||||
* include ANY other files, nor should it include "lam_config.h".
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Set LAM_MALLOC_DEBUG_LEVEL to
|
||||
@ -28,8 +31,60 @@
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
/**
|
||||
* Shut down malloc debug output.
|
||||
*
|
||||
* This function is invoked as part of lam_finalize() to shut down the
|
||||
* output stream for malloc debug messages.
|
||||
*/
|
||||
void lam_malloc_init(void);
|
||||
|
||||
/**
|
||||
* Initialize malloc debug output.
|
||||
*
|
||||
* This function is invoked to setup a dedicated output stream for
|
||||
* malloc debug functions. It does \em not (currently) do anything
|
||||
* other than that (i.e., no internal accounting for tracking
|
||||
* malloc/free statements, etc.).
|
||||
*
|
||||
* It is invoked as part of lam_init(). Although this function is
|
||||
* not \em necessary for LAM_MALLOC() and LAM_FREE(), it is strong
|
||||
* recommended because no output messages -- regardless of the
|
||||
* malloc debug level set by lam_malloc_debug() -- will be displayed
|
||||
* unless this function is invoked first.
|
||||
*/
|
||||
void lam_malloc_finalize(void);
|
||||
|
||||
/**
|
||||
* \internal
|
||||
*
|
||||
* Back-end error-checking malloc function for LAM (you should use
|
||||
* the normal malloc() instead of this function).
|
||||
*
|
||||
* @param size The number of bytes to allocate
|
||||
* @param file Typically the __FILE__ macro
|
||||
* @param line Typically the __LINE__ macro
|
||||
*
|
||||
* This function is only used when --enable-mem-debug was specified to
|
||||
* configure (or by default if you're building in a CVS checkout).
|
||||
*/
|
||||
void *lam_malloc(size_t size, char *file, int line);
|
||||
|
||||
/**
|
||||
* \internal
|
||||
*
|
||||
* Back-end error-checking free function for LAM (you should use
|
||||
* free() instead of this function).
|
||||
*
|
||||
* @param addr Address on the heap to free()
|
||||
* @param file Typically the __FILE__ macro
|
||||
* @param line Typically the __LINE__ macro
|
||||
*
|
||||
* This function is only used when --enable-mem-debug was specified
|
||||
* to configure (or by default if you're building in a CVS
|
||||
* checkout).
|
||||
*/
|
||||
void lam_free(void *addr, char *file, int line);
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
@ -38,8 +93,6 @@ extern int lam_malloc_debug_level;
|
||||
extern int lam_malloc_output;
|
||||
|
||||
static inline void lam_malloc_debug(int level);
|
||||
static inline void *lam_malloc(size_t size, char *file, int line);
|
||||
static inline void lam_free(void *addr, char *file, int line);
|
||||
|
||||
|
||||
/**
|
||||
@ -54,92 +107,4 @@ static inline void lam_malloc_debug(int level)
|
||||
lam_malloc_debug_level = level;
|
||||
}
|
||||
|
||||
/**
|
||||
* \internal
|
||||
*
|
||||
* Back-end error-checking malloc function for LAM (you should use the
|
||||
* LAM_MALLOC() macro instead of this function).
|
||||
*
|
||||
* @param size The number of bytes to allocate
|
||||
* @param file Typically the __FILE__ macro
|
||||
* @param line Typically the __LINE__ macro
|
||||
*/
|
||||
static inline void *lam_malloc(size_t size, char *file, int line)
|
||||
{
|
||||
void *addr;
|
||||
if (lam_malloc_debug_level > 1) {
|
||||
if (size <= 0) {
|
||||
lam_output(lam_malloc_output, "Request for %ld bytes (%s, %d)",
|
||||
(long) size, file, line);
|
||||
}
|
||||
}
|
||||
addr = malloc(size);
|
||||
if (lam_malloc_debug_level > 0) {
|
||||
if (NULL == addr) {
|
||||
lam_output(lam_malloc_output,
|
||||
"Request for %ld bytes failed (%s, %d)",
|
||||
(long) size, file, line);
|
||||
}
|
||||
}
|
||||
|
||||
return addr;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \internal
|
||||
*
|
||||
* Back-end error-checking free function for LAM (you should use the
|
||||
* LAM_FREE() macro instead of this function).
|
||||
*
|
||||
* @param addr Address on the heap to free()
|
||||
* @param file Typically the __FILE__ macro
|
||||
* @param line Typically the __LINE__ macro
|
||||
*/
|
||||
#include <stdio.h>
|
||||
static inline void lam_free(void *addr, char *file, int line)
|
||||
{
|
||||
if (lam_malloc_debug_level > 1 && NULL == addr) {
|
||||
printf("INVALID FREE!\n");
|
||||
lam_output(lam_malloc_output, "Invalid free (%s, %d)", file, line);
|
||||
} else {
|
||||
free(addr);
|
||||
}
|
||||
}
|
||||
|
||||
#if LAM_MALLOC_DEBUG_LEVEL > 0
|
||||
|
||||
/**
|
||||
* Error-checking malloc function for LAM.
|
||||
*
|
||||
* @param SIZE Number of bytes to allocate.
|
||||
*
|
||||
* This macro will invoke lam_malloc() if compile-time debugging was
|
||||
* enabled, or just invoke malloc() directly if compile-time debugging
|
||||
* is disabled.
|
||||
*/
|
||||
#define LAM_MALLOC(SIZE) \
|
||||
lam_malloc(SIZE, __FILE__, __LINE__)
|
||||
|
||||
/**
|
||||
* Error-checking free function for LAM.
|
||||
*
|
||||
* @param ADDR Address to free.
|
||||
*
|
||||
* This macro will invoke lam_free() if compile-time debugging was
|
||||
* enabled, or just invoke free() directly if compile-time debugging
|
||||
* is disabled.
|
||||
*
|
||||
* The memory to be freed can be allocated from anywhere (e.g.,
|
||||
* strdup()) -- it does not have to be allocated by LAM_MALLOC().
|
||||
*/
|
||||
#define LAM_FREE(ADDR) \
|
||||
do { \
|
||||
lam_free((ADDR), __FILE__, __LINE__); \
|
||||
(ADDR) = NULL; \
|
||||
} while (0)
|
||||
#else
|
||||
#define LAM_MALLOC(SIZE) malloc(SIZE)
|
||||
#define LAM_FREE(ADDR) free(ADDR)
|
||||
#endif
|
||||
#endif
|
||||
#endif /* LAM_MALLOC_H */
|
||||
|
@ -327,7 +327,7 @@ int lam_fmp_init_with(lam_fixed_mpool_t *pool, ssize_t initial_allocation,
|
||||
pool->fmp_n_elts_to_add = n_array_elements_to_add;
|
||||
pool->fmp_n_pools = n_pools;
|
||||
pool->fmp_segments = (lam_memseg_t **)
|
||||
LAM_MALLOC(sizeof(lam_memseg_t *)*n_pools);
|
||||
malloc(sizeof(lam_memseg_t *)*n_pools);
|
||||
if ( !pool->fmp_segments )
|
||||
{
|
||||
lam_abort(1, "Unable to allocate memory for "
|
||||
@ -336,7 +336,7 @@ int lam_fmp_init_with(lam_fixed_mpool_t *pool, ssize_t initial_allocation,
|
||||
}
|
||||
bzero(pool->fmp_segments, sizeof(lam_memseg_t *)*n_pools);
|
||||
|
||||
pool->fmp_n_segs_in_array = (int *) LAM_MALLOC(sizeof(int) * n_pools);
|
||||
pool->fmp_n_segs_in_array = malloc(sizeof(int) * n_pools);
|
||||
if ( !pool->fmp_n_segs_in_array ) {
|
||||
lam_abort(1, "Unable to allocate memory for "
|
||||
"pool->fmp_n_segs_in_array, requested %ld bytes, errno %d",
|
||||
@ -444,10 +444,9 @@ void *lam_fmp_get_mem_segment(lam_fixed_mpool_t *pool,
|
||||
pool->fmp_n_segs_in_array[which_pool])
|
||||
{
|
||||
/* create a temp version of pool->fmp_segments[] */
|
||||
tmp_seg = (lam_memseg_t *)
|
||||
LAM_MALLOC(sizeof(lam_memseg_t) *
|
||||
(pool->fmp_n_segments[which_pool] +
|
||||
pool->fmp_n_elts_to_add));
|
||||
tmp_seg = malloc(sizeof(lam_memseg_t) *
|
||||
(pool->fmp_n_segments[which_pool] +
|
||||
pool->fmp_n_elts_to_add));
|
||||
if ( !tmp_seg ) {
|
||||
lam_abort(1, "Unable to allocate memory for tmp_seg, errno %d",
|
||||
errno);
|
||||
@ -465,7 +464,7 @@ void *lam_fmp_get_mem_segment(lam_fixed_mpool_t *pool,
|
||||
pool->fmp_segments[which_pool][seg_idx].ms_mem_available;
|
||||
}
|
||||
|
||||
LAM_FREE(pool->fmp_segments[which_pool]);
|
||||
free(pool->fmp_segments[which_pool]);
|
||||
pool->fmp_segments[which_pool] = tmp_seg;
|
||||
|
||||
/* set the element of pool->fmp_segments to grab */
|
||||
|
@ -49,7 +49,7 @@ lam_argv_append(int *argc, char ***argv, const char *arg)
|
||||
/* Create new argv. */
|
||||
|
||||
if (NULL == *argv) {
|
||||
*argv = LAM_MALLOC(2 * sizeof(char *));
|
||||
*argv = malloc(2 * sizeof(char *));
|
||||
if (NULL == *argv)
|
||||
return LAM_ERROR;
|
||||
*argc = 0;
|
||||
@ -67,7 +67,7 @@ lam_argv_append(int *argc, char ***argv, const char *arg)
|
||||
|
||||
/* Set the newest element to point to a copy of the arg string */
|
||||
|
||||
(*argv)[*argc] = LAM_MALLOC(strlen(arg) + 1);
|
||||
(*argv)[*argc] = malloc(strlen(arg) + 1);
|
||||
if (NULL == (*argv)[*argc])
|
||||
return LAM_ERROR;
|
||||
|
||||
@ -100,10 +100,10 @@ lam_argv_free(char **argv)
|
||||
return;
|
||||
|
||||
for (p = argv; NULL != *p; ++p) {
|
||||
LAM_FREE(*p);
|
||||
free(*p);
|
||||
}
|
||||
|
||||
LAM_FREE(argv);
|
||||
free(argv);
|
||||
}
|
||||
|
||||
|
||||
@ -156,7 +156,7 @@ lam_argv_split(const char *src_string, int delimiter)
|
||||
/* long argument, malloc buffer, copy and add */
|
||||
|
||||
else if (arglen > (ARGSIZE - 1)) {
|
||||
argtemp = LAM_MALLOC(arglen + 1);
|
||||
argtemp = malloc(arglen + 1);
|
||||
if (NULL == argtemp)
|
||||
return NULL;
|
||||
|
||||
@ -164,11 +164,11 @@ lam_argv_split(const char *src_string, int delimiter)
|
||||
argtemp[arglen] = '\0';
|
||||
|
||||
if (LAM_ERROR == lam_argv_append(&argc, &argv, argtemp)) {
|
||||
LAM_FREE(argtemp);
|
||||
free(argtemp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
LAM_FREE(argtemp);
|
||||
free(argtemp);
|
||||
}
|
||||
|
||||
/* short argument, copy to buffer and add */
|
||||
@ -250,7 +250,7 @@ lam_argv_join(char **argv, int delimiter)
|
||||
|
||||
/* Allocate the string. */
|
||||
|
||||
if (NULL == (str = LAM_MALLOC(str_len)))
|
||||
if (NULL == (str = malloc(str_len)))
|
||||
return NULL;
|
||||
|
||||
/* Loop filling in the string. */
|
||||
|
@ -97,7 +97,7 @@ static cmd_line_option_t *find_option(lam_cmd_line_t *cmd,
|
||||
*/
|
||||
lam_cmd_line_t *lam_cmd_line_create(void)
|
||||
{
|
||||
lam_cmd_line_t *cmd = LAM_MALLOC(sizeof(lam_cmd_line_t));
|
||||
lam_cmd_line_t *cmd = malloc(sizeof(lam_cmd_line_t));
|
||||
|
||||
if (NULL == cmd)
|
||||
return NULL;
|
||||
@ -164,10 +164,10 @@ void lam_cmd_line_free(lam_cmd_line_t *cmd)
|
||||
item = lam_list_remove_first(&cmd->lcl_options)) {
|
||||
option = (cmd_line_option_t *) item;
|
||||
if (NULL != option->clo_long_name)
|
||||
LAM_FREE(option->clo_long_name);
|
||||
free(option->clo_long_name);
|
||||
if (NULL != option->clo_description)
|
||||
LAM_FREE(option->clo_description);
|
||||
LAM_FREE(item);
|
||||
free(option->clo_description);
|
||||
free(item);
|
||||
}
|
||||
|
||||
/* Free any parsed results */
|
||||
@ -176,7 +176,7 @@ void lam_cmd_line_free(lam_cmd_line_t *cmd)
|
||||
|
||||
/* Now free the cmd itself */
|
||||
|
||||
LAM_FREE(cmd);
|
||||
free(cmd);
|
||||
}
|
||||
|
||||
|
||||
@ -222,7 +222,7 @@ int lam_cmd_line_make_opt(lam_cmd_line_t *cmd, char short_name,
|
||||
|
||||
/* Allocate and fill an option item */
|
||||
|
||||
option = LAM_MALLOC(sizeof(cmd_line_option_t));
|
||||
option = malloc(sizeof(cmd_line_option_t));
|
||||
if (NULL == option)
|
||||
return LAM_ERR_OUT_OF_RESOURCE;
|
||||
lam_list_item_init((lam_list_item_t *) option);
|
||||
@ -387,7 +387,7 @@ int lam_cmd_line_parse(lam_cmd_line_t *cmd, bool ignore_unknown,
|
||||
them are the special_empty_param (insertted by
|
||||
split_shorts()), then print an error and return. */
|
||||
|
||||
param = LAM_MALLOC(sizeof(cmd_line_param_t));
|
||||
param = malloc(sizeof(cmd_line_param_t));
|
||||
if (NULL == param) {
|
||||
lam_mutex_unlock(&cmd->lcl_mutex);
|
||||
return LAM_ERR_OUT_OF_RESOURCE;
|
||||
@ -412,7 +412,7 @@ int lam_cmd_line_parse(lam_cmd_line_t *cmd, bool ignore_unknown,
|
||||
cmd->lcl_argv[orig], option->clo_num_params);
|
||||
if (NULL != param->clp_argv)
|
||||
lam_argv_free(param->clp_argv);
|
||||
LAM_FREE(param);
|
||||
free(param);
|
||||
i = cmd->lcl_argc;
|
||||
break;
|
||||
} else {
|
||||
@ -422,7 +422,7 @@ int lam_cmd_line_parse(lam_cmd_line_t *cmd, bool ignore_unknown,
|
||||
cmd->lcl_argv[orig], option->clo_num_params);
|
||||
if (NULL != param->clp_argv)
|
||||
lam_argv_free(param->clp_argv);
|
||||
LAM_FREE(param);
|
||||
free(param);
|
||||
i = cmd->lcl_argc;
|
||||
break;
|
||||
}
|
||||
@ -530,9 +530,9 @@ char *lam_cmd_line_get_usage_msg(lam_cmd_line_t *cmd)
|
||||
|
||||
if (len > prev_len) {
|
||||
if (NULL != line) {
|
||||
LAM_FREE(line);
|
||||
free(line);
|
||||
}
|
||||
line = LAM_MALLOC(len * 2);
|
||||
line = malloc(len * 2);
|
||||
if (NULL == line) {
|
||||
lam_mutex_unlock(&cmd->lcl_mutex);
|
||||
return NULL;
|
||||
@ -571,7 +571,7 @@ char *lam_cmd_line_get_usage_msg(lam_cmd_line_t *cmd)
|
||||
}
|
||||
}
|
||||
if (line != NULL) {
|
||||
LAM_FREE(line);
|
||||
free(line);
|
||||
}
|
||||
if (argv != NULL) {
|
||||
ret = lam_argv_join(argv, '\n');
|
||||
@ -759,7 +759,7 @@ static void free_parse_results(lam_cmd_line_t *cmd)
|
||||
for (item = lam_list_remove_first(&cmd->lcl_params);
|
||||
NULL != item;
|
||||
item = lam_list_remove_first(&cmd->lcl_params)) {
|
||||
LAM_FREE(item);
|
||||
free(item);
|
||||
}
|
||||
|
||||
/* Free the argv's */
|
||||
|
@ -133,7 +133,7 @@ static int lam_ifinit(void)
|
||||
}
|
||||
memcpy(&intf.if_mask, &ifr->ifr_addr, sizeof(intf.if_mask));
|
||||
|
||||
intf_ptr = (lam_if_t*)LAM_MALLOC(sizeof(lam_if_t));
|
||||
intf_ptr = malloc(sizeof(lam_if_t));
|
||||
if(intf_ptr == 0) {
|
||||
lam_output(0, "lam_ifinit: unable to allocated %d bytes\n", sizeof(lam_if_t));
|
||||
return LAM_ERR_OUT_OF_RESOURCE;
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "lam/constants.h"
|
||||
#include "lam/mem/malloc.h"
|
||||
#include "lam/util/output.h"
|
||||
#include "lam/threads/mutex.h"
|
||||
|
||||
@ -286,7 +285,7 @@ void lam_output_close(int output_id)
|
||||
/* Somewhat of a hack to free up the temp_str */
|
||||
|
||||
if (NULL != temp_str) {
|
||||
LAM_FREE(temp_str);
|
||||
free(temp_str);
|
||||
temp_str = NULL;
|
||||
temp_str_len = 0;
|
||||
}
|
||||
@ -474,7 +473,7 @@ static int do_open(int output_id, lam_output_stream_t *lds)
|
||||
#if NEED_TO_IMPLEMENT_SESSION_DIRECTORY
|
||||
filename = lam_get_tmpdir();
|
||||
#else
|
||||
filename = LAM_MALLOC(256);
|
||||
filename = malloc(256);
|
||||
strcpy(filename, "/tmp");
|
||||
#endif
|
||||
strcat(filename, "/lam-");
|
||||
@ -501,7 +500,7 @@ static int do_open(int output_id, lam_output_stream_t *lds)
|
||||
problems */
|
||||
|
||||
fcntl(info[i].ldi_fd, F_SETFD, 1);
|
||||
LAM_FREE(filename);
|
||||
free(filename);
|
||||
}
|
||||
|
||||
return i;
|
||||
@ -528,15 +527,15 @@ static void free_descriptor(int output_id)
|
||||
/* If we strduped a prefix, suffix, or syslog ident, free it */
|
||||
|
||||
if (NULL != ldi->ldi_prefix)
|
||||
LAM_FREE(ldi->ldi_prefix);
|
||||
free(ldi->ldi_prefix);
|
||||
ldi->ldi_prefix = NULL;
|
||||
|
||||
if (NULL != ldi->ldi_file_suffix)
|
||||
LAM_FREE(ldi->ldi_file_suffix);
|
||||
free(ldi->ldi_file_suffix);
|
||||
ldi->ldi_file_suffix = NULL;
|
||||
|
||||
if (NULL != ldi->ldi_syslog_ident)
|
||||
LAM_FREE(ldi->ldi_syslog_ident);
|
||||
free(ldi->ldi_syslog_ident);
|
||||
ldi->ldi_syslog_ident = NULL;
|
||||
}
|
||||
}
|
||||
@ -579,7 +578,7 @@ static void output(int output_id, char *format, va_list arglist)
|
||||
total_len += strlen(ldi->ldi_prefix);
|
||||
if (temp_str_len < total_len + want_newline) {
|
||||
if (NULL != temp_str)
|
||||
LAM_FREE(temp_str);
|
||||
free(temp_str);
|
||||
temp_str = malloc(total_len * 2);
|
||||
temp_str_len = total_len * 2;
|
||||
}
|
||||
@ -620,7 +619,7 @@ static void output(int output_id, char *format, va_list arglist)
|
||||
write(ldi->ldi_fd, temp_str, total_len);
|
||||
THREAD_UNLOCK(&mutex);
|
||||
|
||||
LAM_FREE(str);
|
||||
free(str);
|
||||
}
|
||||
}
|
||||
|
||||
@ -787,7 +786,7 @@ static char *lam_vsnprintf(char *format, va_list arglist)
|
||||
/* Wasn't that simple? Now malloc out a string and do the final
|
||||
formatting into that string. */
|
||||
|
||||
sarg = LAM_MALLOC(len);
|
||||
sarg = malloc(len);
|
||||
vsprintf(sarg, format, arglist2);
|
||||
|
||||
/* Return the new string */
|
||||
|
@ -83,14 +83,14 @@ lam_path_findv(char *fname, char **pathv, int mode, char **envv)
|
||||
if (!delimit) {
|
||||
fullpath = path_access(fname, env, mode);
|
||||
} else {
|
||||
pfix = LAM_MALLOC(strlen(env) + strlen(delimit) + 1);
|
||||
pfix = malloc(strlen(env) + strlen(delimit) + 1);
|
||||
if (NULL == pfix){
|
||||
return(0);
|
||||
}
|
||||
strcpy(pfix, env);
|
||||
strcat(pfix, delimit);
|
||||
fullpath = path_access(fname, pfix, mode);
|
||||
LAM_FREE(pfix);
|
||||
free(pfix);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -164,7 +164,7 @@ lam_path_env_findv(char *fname, int mode, char **envv, char *wrkdir)
|
||||
for (i = 0; i < dirc; ++i) {
|
||||
if ((0 == strcmp(dirv[i], ".")) && wrkdir) {
|
||||
found_dot = 1;
|
||||
LAM_FREE(dirv[i]);
|
||||
free(dirv[i]);
|
||||
dirv[i] = strdup(wrkdir);
|
||||
if (NULL == dirv[i]){
|
||||
return(0);
|
||||
@ -225,7 +225,7 @@ path_access(char *fname, char *path, int mode)
|
||||
/*
|
||||
* Allocate space for the full pathname.
|
||||
*/
|
||||
fullpath = LAM_MALLOC(strlen(path) + strlen(fname) + 2);
|
||||
fullpath = malloc(strlen(path) + strlen(fname) + 2);
|
||||
if (NULL == fullpath){
|
||||
return(0);
|
||||
}
|
||||
@ -242,7 +242,7 @@ path_access(char *fname, char *path, int mode)
|
||||
* Then check the permissions.
|
||||
*/
|
||||
if (access(fullpath, mode)) {
|
||||
LAM_FREE(fullpath);
|
||||
free(fullpath);
|
||||
fullpath = 0;
|
||||
}
|
||||
|
||||
|
@ -226,7 +226,7 @@ void lam_reactor_dispatch(lam_reactor_t* r, int cnt, lam_fd_set_t* rset, lam_fd_
|
||||
lam_list_append(&r->r_free, &descriptor->super);
|
||||
} else {
|
||||
lam_reactor_descriptor_destroy(descriptor);
|
||||
LAM_FREE(descriptor);
|
||||
free(descriptor);
|
||||
}
|
||||
}
|
||||
descriptor = next;
|
||||
@ -241,7 +241,7 @@ void lam_reactor_dispatch(lam_reactor_t* r, int cnt, lam_fd_set_t* rset, lam_fd_
|
||||
lam_list_append(&r->r_free, &descriptor->super);
|
||||
} else {
|
||||
lam_reactor_descriptor_destroy(descriptor);
|
||||
LAM_FREE(descriptor);
|
||||
free(descriptor);
|
||||
}
|
||||
} else {
|
||||
lam_list_append(&r->r_active, &descriptor->super);
|
||||
|
@ -65,7 +65,7 @@ int mca_base_cmd_line_process_args(lam_cmd_line_t *cmd)
|
||||
|
||||
for (i = 0; NULL != mca_param_argv[i]; ++i) {
|
||||
buflen = strlen(mca_param_argv[i]) + strlen(mca_value_argv[i]) + 32;
|
||||
buf = LAM_MALLOC(buflen);
|
||||
buf = malloc(buflen);
|
||||
if (NULL == buf)
|
||||
return LAM_ERR_OUT_OF_RESOURCE;
|
||||
|
||||
@ -95,9 +95,9 @@ int mca_base_cmd_line_process_arg(const char *param, const char *value)
|
||||
for (i = 0; NULL != mca_param_argv && NULL != mca_param_argv[i]; ++i) {
|
||||
if (0 == strcmp(param, mca_param_argv[i])) {
|
||||
len = strlen(value) + strlen(mca_param_argv[i]);
|
||||
new_str = LAM_MALLOC(len);
|
||||
new_str = malloc(len);
|
||||
snprintf(new_str, len, "%s,%s", mca_value_argv[i], value);
|
||||
LAM_FREE(mca_value_argv[i]);
|
||||
free(mca_value_argv[i]);
|
||||
mca_value_argv[i] = new_str;
|
||||
|
||||
return LAM_SUCCESS;
|
||||
|
@ -102,7 +102,7 @@ int mca_base_module_find(const char *directory, const char *type,
|
||||
|
||||
lam_list_init(found_modules);
|
||||
for (i = 0; NULL != static_modules[i]; ++i) {
|
||||
mli = LAM_MALLOC(sizeof(mca_base_module_list_item_t));
|
||||
mli = malloc(sizeof(mca_base_module_list_item_t));
|
||||
if (NULL == mli) {
|
||||
return LAM_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
@ -206,20 +206,20 @@ static void find_dyn_modules(const char *path, const char *type_name,
|
||||
lam_list_get_end(&found_files) != cur; ) {
|
||||
file = (module_file_item_t *) cur;
|
||||
cur = lam_list_get_next(cur);
|
||||
LAM_FREE(file);
|
||||
free(file);
|
||||
lam_list_remove_first(&found_files);
|
||||
}
|
||||
|
||||
/* All done */
|
||||
|
||||
if (NULL != param) {
|
||||
LAM_FREE(param);
|
||||
free(param);
|
||||
}
|
||||
/* JMS This list memory management may change */
|
||||
#if 0
|
||||
lam_list_destroy(&found_files);
|
||||
#endif
|
||||
LAM_FREE(path_to_use);
|
||||
free(path_to_use);
|
||||
}
|
||||
|
||||
|
||||
@ -243,7 +243,7 @@ static int save_filename(const char *filename, lt_ptr data)
|
||||
if (NULL != params->name) {
|
||||
len += strlen(params->name);
|
||||
}
|
||||
prefix = LAM_MALLOC(len);
|
||||
prefix = malloc(len);
|
||||
snprintf(prefix, len, module_template, params->type);
|
||||
prefix_len = strlen(prefix);
|
||||
if (NULL != params->name) {
|
||||
@ -259,13 +259,13 @@ static int save_filename(const char *filename, lt_ptr data)
|
||||
}
|
||||
|
||||
if (0 != strncmp(basename, prefix, total_len)) {
|
||||
LAM_FREE(prefix);
|
||||
free(prefix);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Save all the info and put it in the list of found modules */
|
||||
|
||||
module_file = LAM_MALLOC(sizeof(module_file_item_t));
|
||||
module_file = malloc(sizeof(module_file_item_t));
|
||||
if (NULL == module_file) {
|
||||
return LAM_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
@ -279,7 +279,7 @@ static int save_filename(const char *filename, lt_ptr data)
|
||||
|
||||
/* All done */
|
||||
|
||||
LAM_FREE(prefix);
|
||||
free(prefix);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -354,7 +354,7 @@ static int open_module(module_file_item_t *target_file,
|
||||
Malloc out enough space for it. */
|
||||
|
||||
len = strlen(target_file->type) + strlen(target_file->name) + 32;
|
||||
struct_name = LAM_MALLOC(len);
|
||||
struct_name = malloc(len);
|
||||
if (NULL == struct_name) {
|
||||
lt_dlclose(module_handle);
|
||||
target_file->status = FAILED_TO_LOAD;
|
||||
@ -364,9 +364,9 @@ static int open_module(module_file_item_t *target_file,
|
||||
snprintf(struct_name, len, "mca_%s_%s_module", target_file->type,
|
||||
target_file->name);
|
||||
|
||||
mitem = LAM_MALLOC(sizeof(mca_base_module_list_item_t));
|
||||
mitem = malloc(sizeof(mca_base_module_list_item_t));
|
||||
if (NULL == mitem) {
|
||||
LAM_FREE(struct_name);
|
||||
free(struct_name);
|
||||
lt_dlclose(module_handle);
|
||||
target_file->status = FAILED_TO_LOAD;
|
||||
free_dependency_list(&dependencies);
|
||||
@ -379,8 +379,8 @@ static int open_module(module_file_item_t *target_file,
|
||||
lam_output_verbose(0, 40, " \"%s\" does not appear to be a valid "
|
||||
"%s MCA dynamic module (ignored)",
|
||||
target_file->basename, target_file->type, NULL);
|
||||
LAM_FREE(mitem);
|
||||
LAM_FREE(struct_name);
|
||||
free(mitem);
|
||||
free(struct_name);
|
||||
lt_dlclose(module_handle);
|
||||
target_file->status = FAILED_TO_LOAD;
|
||||
free_dependency_list(&dependencies);
|
||||
@ -406,7 +406,7 @@ static int open_module(module_file_item_t *target_file,
|
||||
target_file->name,
|
||||
ditem->di_module_file_item->type,
|
||||
ditem->di_module_file_item->name);
|
||||
LAM_FREE(ditem);
|
||||
free(ditem);
|
||||
}
|
||||
lam_list_destroy(&dependencies);
|
||||
|
||||
@ -416,7 +416,7 @@ static int open_module(module_file_item_t *target_file,
|
||||
|
||||
/* All done */
|
||||
|
||||
LAM_FREE(struct_name);
|
||||
free(struct_name);
|
||||
return LAM_SUCCESS;
|
||||
}
|
||||
|
||||
@ -439,7 +439,7 @@ static int check_laminfo(module_file_item_t *target_file,
|
||||
/* Form the filename */
|
||||
|
||||
len = strlen(target_file->filename) + strlen(laminfo_suffix) + 16;
|
||||
depname = LAM_MALLOC(len);
|
||||
depname = malloc(len);
|
||||
if (NULL == depname)
|
||||
return LAM_ERR_OUT_OF_RESOURCE;
|
||||
snprintf(depname, len, "%s%s", target_file->filename, laminfo_suffix);
|
||||
@ -448,7 +448,7 @@ static int check_laminfo(module_file_item_t *target_file,
|
||||
there are no dependencies). */
|
||||
|
||||
if (NULL == (fp = fopen(depname, "r"))) {
|
||||
LAM_FREE(depname);
|
||||
free(depname);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -484,7 +484,7 @@ static int check_laminfo(module_file_item_t *target_file,
|
||||
target_file, dependencies,
|
||||
found_modules)) {
|
||||
fclose(fp);
|
||||
LAM_FREE(depname);
|
||||
free(depname);
|
||||
|
||||
/* We can leave any successfully loaded dependencies; we might
|
||||
need them again later. But free the dependency list for
|
||||
@ -504,7 +504,7 @@ static int check_laminfo(module_file_item_t *target_file,
|
||||
/* All done -- all depenencies satisfied */
|
||||
|
||||
fclose(fp);
|
||||
LAM_FREE(depname);
|
||||
free(depname);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -621,7 +621,7 @@ static int check_dependency(char *line, module_file_item_t *target_file,
|
||||
/* The dependency loaded properly. Increment its refcount so that
|
||||
it doesn't get unloaded before we get unloaded. */
|
||||
|
||||
ditem = LAM_MALLOC(sizeof(dependency_item_t));
|
||||
ditem = malloc(sizeof(dependency_item_t));
|
||||
if (NULL == ditem) {
|
||||
return LAM_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
@ -645,7 +645,7 @@ static void free_dependency_list(lam_list_t *dependencies)
|
||||
for (item = lam_list_remove_first(dependencies);
|
||||
NULL != item;
|
||||
item = lam_list_remove_first(dependencies)) {
|
||||
LAM_FREE(item);
|
||||
free(item);
|
||||
}
|
||||
lam_list_destroy(dependencies);
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ int mca_base_module_registry_retain(char *type, lt_dlhandle module_handle,
|
||||
|
||||
/* Allocate a new registry item */
|
||||
|
||||
ri = LAM_MALLOC(sizeof(registry_item_t));
|
||||
ri = malloc(sizeof(registry_item_t));
|
||||
if (NULL == ri)
|
||||
return LAM_ERR_OUT_OF_RESOURCE;
|
||||
|
||||
@ -228,7 +228,7 @@ static int link_items(registry_item_t *src, registry_item_t *depend)
|
||||
|
||||
/* Make a new depedency item */
|
||||
|
||||
di = LAM_MALLOC(sizeof(dependency_item_t));
|
||||
di = malloc(sizeof(dependency_item_t));
|
||||
if (NULL == di)
|
||||
return LAM_ERR_OUT_OF_RESOURCE;
|
||||
|
||||
@ -275,7 +275,7 @@ static void release_registry_item(registry_item_t *ri)
|
||||
item = lam_list_remove_first(&ri->ri_dependencies)) {
|
||||
di = (dependency_item_t *) item;
|
||||
--di->di_registry_entry->ri_refcount;
|
||||
LAM_FREE(di);
|
||||
free(di);
|
||||
}
|
||||
|
||||
/* It should be obvious, but I'll state it anyway because it bit
|
||||
@ -285,6 +285,6 @@ static void release_registry_item(registry_item_t *ri)
|
||||
|
||||
lam_list_destroy(&di->di_registry_entry->ri_dependencies);
|
||||
lam_list_remove_item(®istry, (lam_list_item_t *) ri);
|
||||
LAM_FREE(ri);
|
||||
free(ri);
|
||||
}
|
||||
}
|
||||
|
@ -45,14 +45,14 @@ int mca_base_modules_close(int output_id, lam_list_t *modules_available,
|
||||
lam_output_verbose(10, output_id, "close: module %s unloaded",
|
||||
module->mca_module_name);
|
||||
}
|
||||
LAM_FREE(mli);
|
||||
free(mli);
|
||||
}
|
||||
|
||||
/* Re-add the skipped module to the available list (see above
|
||||
comment) */
|
||||
|
||||
if (NULL != skip) {
|
||||
mli = LAM_MALLOC(sizeof(mca_base_module_list_item_t));
|
||||
mli = malloc(sizeof(mca_base_module_list_item_t));
|
||||
if (NULL == mli) {
|
||||
return LAM_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "lam/lfc/list.h"
|
||||
#include "lam/util/strncpy.h"
|
||||
#include "lam/util/argv.h"
|
||||
#include "lam/util/output.h"
|
||||
#include "mca/mca.h"
|
||||
#include "mca/lam/base/base.h"
|
||||
|
||||
@ -82,7 +83,7 @@ int mca_base_modules_open(const char *type_name, int output_id,
|
||||
|
||||
for (item = lam_list_remove_first(&modules_found); NULL != item;
|
||||
item = lam_list_remove_first(&modules_found)) {
|
||||
LAM_FREE(item);
|
||||
free(item);
|
||||
}
|
||||
if (NULL != requested_module_names) {
|
||||
lam_argv_free(requested_module_names);
|
||||
@ -249,7 +250,7 @@ static int open_modules(const char *type_name, int output_id,
|
||||
"priority", NULL, 0);
|
||||
}
|
||||
|
||||
mli = LAM_MALLOC(sizeof(mca_base_module_list_item_t));
|
||||
mli = malloc(sizeof(mca_base_module_list_item_t));
|
||||
if (NULL == mli) {
|
||||
return LAM_ERROR;
|
||||
}
|
||||
|
@ -155,5 +155,5 @@ static void parse_verbose(char *e, lam_output_stream_t *lds)
|
||||
|
||||
/* All done */
|
||||
|
||||
LAM_FREE(edup);
|
||||
free(edup);
|
||||
}
|
||||
|
@ -253,12 +253,12 @@ int mca_base_param_finalize(void)
|
||||
param_free(array[i]);
|
||||
/* JMS Memory management of the array may change when array.[ch]
|
||||
changes */
|
||||
LAM_FREE(array[i]);
|
||||
free(array[i]);
|
||||
lam_arr_remove_item(&mca_base_params, i);
|
||||
}
|
||||
/* JMS Memory management of the array may change when array.[ch]
|
||||
changes */
|
||||
LAM_FREE(array);
|
||||
free(array);
|
||||
initialized = false;
|
||||
}
|
||||
|
||||
@ -286,7 +286,7 @@ static int param_register(const char *type_name, const char *module_name,
|
||||
/* Create a parameter entry. If a keyval is to be used, it will be
|
||||
registered elsewhere. We simply assign -1 here. */
|
||||
|
||||
param = LAM_MALLOC(sizeof(mca_base_param_t));
|
||||
param = malloc(sizeof(mca_base_param_t));
|
||||
if (NULL == param) {
|
||||
return LAM_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
@ -301,7 +301,7 @@ static int param_register(const char *type_name, const char *module_name,
|
||||
if (NULL != module_name) {
|
||||
param->mbp_module_name = strdup(module_name);
|
||||
if (NULL == param->mbp_module_name) {
|
||||
LAM_FREE(param->mbp_type_name);
|
||||
free(param->mbp_type_name);
|
||||
return LAM_ERROR;
|
||||
}
|
||||
} else {
|
||||
@ -310,8 +310,8 @@ static int param_register(const char *type_name, const char *module_name,
|
||||
if (param_name != NULL) {
|
||||
param->mbp_param_name = strdup(param_name);
|
||||
if (NULL == param->mbp_param_name) {
|
||||
LAM_FREE(param->mbp_type_name);
|
||||
LAM_FREE(param->mbp_module_name);
|
||||
free(param->mbp_type_name);
|
||||
free(param->mbp_module_name);
|
||||
return LAM_ERROR;
|
||||
}
|
||||
} else {
|
||||
@ -336,16 +336,16 @@ static int param_register(const char *type_name, const char *module_name,
|
||||
len += strlen(param_name);
|
||||
}
|
||||
|
||||
param->mbp_full_name = LAM_MALLOC(len);
|
||||
param->mbp_full_name = malloc(len);
|
||||
if (NULL == param->mbp_full_name) {
|
||||
if (NULL != param->mbp_type_name) {
|
||||
LAM_FREE(param->mbp_type_name);
|
||||
free(param->mbp_type_name);
|
||||
}
|
||||
if (NULL != param->mbp_module_name) {
|
||||
LAM_FREE(param->mbp_module_name);
|
||||
free(param->mbp_module_name);
|
||||
}
|
||||
if (NULL != param->mbp_param_name) {
|
||||
LAM_FREE(param->mbp_param_name);
|
||||
free(param->mbp_param_name);
|
||||
}
|
||||
return LAM_ERROR;
|
||||
}
|
||||
@ -367,12 +367,12 @@ static int param_register(const char *type_name, const char *module_name,
|
||||
|
||||
if (MCA_BASE_PARAM_INFO != mca_param_name) {
|
||||
len = strlen(param->mbp_full_name) + strlen(mca_prefix) + 16;
|
||||
param->mbp_env_var_name = LAM_MALLOC(len);
|
||||
param->mbp_env_var_name = malloc(len);
|
||||
if (NULL == param->mbp_env_var_name) {
|
||||
LAM_FREE(param->mbp_full_name);
|
||||
LAM_FREE(param->mbp_type_name);
|
||||
LAM_FREE(param->mbp_module_name);
|
||||
LAM_FREE(param->mbp_param_name);
|
||||
free(param->mbp_full_name);
|
||||
free(param->mbp_type_name);
|
||||
free(param->mbp_module_name);
|
||||
free(param->mbp_param_name);
|
||||
return LAM_ERROR;
|
||||
}
|
||||
snprintf(param->mbp_env_var_name, len, "%s%s", mca_prefix,
|
||||
@ -402,7 +402,7 @@ static int param_register(const char *type_name, const char *module_name,
|
||||
|
||||
if (MCA_BASE_PARAM_TYPE_STRING == array[i]->mbp_type &&
|
||||
NULL != array[i]->mbp_default_value.stringval) {
|
||||
LAM_FREE(array[i]->mbp_default_value.stringval);
|
||||
free(array[i]->mbp_default_value.stringval);
|
||||
}
|
||||
if (MCA_BASE_PARAM_TYPE_STRING == param->mbp_type &&
|
||||
NULL != param->mbp_default_value.stringval) {
|
||||
@ -411,7 +411,7 @@ static int param_register(const char *type_name, const char *module_name,
|
||||
}
|
||||
|
||||
param_free(param);
|
||||
LAM_FREE(param);
|
||||
free(param);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@ -498,22 +498,22 @@ static bool param_lookup(int index, mca_base_param_storage_t *storage)
|
||||
static void param_free(mca_base_param_t *p)
|
||||
{
|
||||
if (NULL != p->mbp_type_name) {
|
||||
LAM_FREE(p->mbp_type_name);
|
||||
free(p->mbp_type_name);
|
||||
}
|
||||
if (NULL != p->mbp_module_name) {
|
||||
LAM_FREE(p->mbp_module_name);
|
||||
free(p->mbp_module_name);
|
||||
}
|
||||
if (NULL != p->mbp_param_name) {
|
||||
LAM_FREE(p->mbp_param_name);
|
||||
free(p->mbp_param_name);
|
||||
}
|
||||
if (NULL != p->mbp_env_var_name) {
|
||||
LAM_FREE(p->mbp_env_var_name);
|
||||
free(p->mbp_env_var_name);
|
||||
}
|
||||
if (NULL != p->mbp_full_name) {
|
||||
LAM_FREE(p->mbp_full_name);
|
||||
free(p->mbp_full_name);
|
||||
}
|
||||
if (MCA_BASE_PARAM_TYPE_STRING == p->mbp_type &&
|
||||
NULL != p->mbp_default_value.stringval) {
|
||||
LAM_FREE(p->mbp_default_value.stringval);
|
||||
free(p->mbp_default_value.stringval);
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "lam/runtime/runtime.h"
|
||||
#include "lam/util/output.h"
|
||||
#include "mca/mca.h"
|
||||
#include "mca/lam/base/base.h"
|
||||
#include "mca/lam/oob/oob.h"
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "lam/runtime/runtime.h"
|
||||
#include "lam/util/output.h"
|
||||
#include "mca/mca.h"
|
||||
#include "mca/lam/base/base.h"
|
||||
#include "mca/lam/pcm/pcm.h"
|
||||
|
@ -45,7 +45,7 @@ mca_pcm_cofs_handle_new(lam_job_handle_t parent)
|
||||
pid = getpid();
|
||||
|
||||
ret_len = sizeof(pid_t) * 8 + strlen("pcm_cofs_job_handle") + sizeof(int) * 8 + 5;
|
||||
ret = LAM_MALLOC(ret_len);
|
||||
ret = malloc(ret_len);
|
||||
if (ret == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
@ -71,7 +71,7 @@ mca_pcm_cofs_handle_free(lam_job_handle_t * job_handle)
|
||||
printf("WARNING: attempting to free static internal job handle!\n");
|
||||
printf(" Did you perhaps try to free the return from handle_get()?\n");
|
||||
} else if (*job_handle != NULL) {
|
||||
LAM_FREE(*job_handle);
|
||||
free(*job_handle);
|
||||
*job_handle = NULL;
|
||||
}
|
||||
}
|
||||
@ -160,7 +160,7 @@ mca_pcm_cofs_proc_startup(void)
|
||||
return LAM_ERR_FATAL;
|
||||
}
|
||||
|
||||
mca_pcm_cofs_procs = LAM_MALLOC(sizeof(mca_pcm_proc_t) * mca_pcm_cofs_nprocs);
|
||||
mca_pcm_cofs_procs = malloc(sizeof(mca_pcm_proc_t) * mca_pcm_cofs_nprocs);
|
||||
if (mca_pcm_cofs_procs == NULL) {
|
||||
return LAM_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
@ -136,18 +136,18 @@ mca_pcm_cofs_init(int *priority, bool *allow_multi_user_threads,
|
||||
/*
|
||||
* See if we can write in our directory...
|
||||
*/
|
||||
tmp = LAM_MALLOC(strlen(mca_pcm_cofs_comm_loc) + 5);
|
||||
tmp = malloc(strlen(mca_pcm_cofs_comm_loc) + 5);
|
||||
if (tmp == NULL) return NULL;
|
||||
sprintf(tmp, "%s/me", mca_pcm_cofs_comm_loc);
|
||||
fp = fopen(tmp, "w");
|
||||
if (fp == NULL) {
|
||||
printf("pcm_cofs can not write in communication dir\n");
|
||||
LAM_FREE(tmp);
|
||||
free(tmp);
|
||||
return NULL;
|
||||
}
|
||||
fclose(fp);
|
||||
unlink(tmp);
|
||||
LAM_FREE(tmp);
|
||||
free(tmp);
|
||||
|
||||
/*
|
||||
* BWB - fix me, make register the "right" way...
|
||||
@ -179,7 +179,7 @@ int
|
||||
mca_pcm_cofs_finalize(void)
|
||||
{
|
||||
if (mca_pcm_cofs_procs != NULL) {
|
||||
LAM_FREE(mca_pcm_cofs_procs);
|
||||
free(mca_pcm_cofs_procs);
|
||||
mca_pcm_cofs_procs = NULL;
|
||||
mca_pcm_cofs_nprocs = 0;
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "lam/runtime/runtime.h"
|
||||
#include "lam/util/output.h"
|
||||
#include "mca/mca.h"
|
||||
#include "mca/lam/base/base.h"
|
||||
#include "mca/lam/registry/registry.h"
|
||||
|
@ -26,7 +26,7 @@ int mca_mpi_alloc_mem(MPI_Aint size, MPI_Info info, void *baseptr)
|
||||
|
||||
/* Do the alloc */
|
||||
|
||||
temp = LAM_MALLOC(size);
|
||||
temp = malloc(size);
|
||||
if (NULL == temp)
|
||||
return LAM_ERROR;
|
||||
|
||||
@ -40,7 +40,7 @@ int mca_mpi_alloc_mem(MPI_Aint size, MPI_Info info, void *baseptr)
|
||||
int mca_mpi_free_mem(void *baseptr)
|
||||
{
|
||||
if (NULL != baseptr)
|
||||
LAM_FREE(baseptr);
|
||||
free(baseptr);
|
||||
|
||||
return MPI_SUCCESS;
|
||||
}
|
||||
|
@ -54,9 +54,9 @@ int mca_coll_basic_alltoall(void *sbuf, int scount,
|
||||
|
||||
nreqs = 2 * (size - 1);
|
||||
if (nreqs > 0) {
|
||||
req = (MPI_Request *) LAM_MALLOC(nreqs * sizeof(MPI_Request));
|
||||
req = malloc(nreqs * sizeof(MPI_Request));
|
||||
if (NULL == req) {
|
||||
LAM_FREE(req);
|
||||
free(req);
|
||||
return ENOMEM;
|
||||
}
|
||||
} else {
|
||||
@ -121,7 +121,7 @@ int mca_coll_basic_alltoall(void *sbuf, int scount,
|
||||
|
||||
err = MPI_Startall(nreqs, req);
|
||||
if (MPI_SUCCESS != err) {
|
||||
LAM_FREE(req);
|
||||
free(req);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -129,20 +129,20 @@ int mca_coll_basic_alltoall(void *sbuf, int scount,
|
||||
|
||||
err = MPI_Waitall(nreqs, req, MPI_STATUSES_IGNORE);
|
||||
if (MPI_SUCCESS != err) {
|
||||
LAM_FREE(req);
|
||||
free(req);
|
||||
return err;
|
||||
}
|
||||
|
||||
for (i = 0, preq = req; i < nreqs; ++i, ++preq) {
|
||||
err = MPI_Request_free(preq);
|
||||
if (MPI_SUCCESS != err) {
|
||||
LAM_FREE(req);
|
||||
free(req);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
/* All done */
|
||||
|
||||
LAM_FREE(req);
|
||||
free(req);
|
||||
return MPI_SUCCESS;
|
||||
}
|
||||
|
@ -52,9 +52,9 @@ mca_coll_basic_alltoallv(void *sbuf, int *scounts, int *sdisps,
|
||||
|
||||
nreqs = 2 * (size - 1);
|
||||
if (nreqs > 0) {
|
||||
req = (MPI_Request *) LAM_MALLOC(nreqs * sizeof(MPI_Request));
|
||||
req = malloc(nreqs * sizeof(MPI_Request));
|
||||
if (NULL == req) {
|
||||
LAM_FREE(req);
|
||||
free(req);
|
||||
return ENOMEM;
|
||||
}
|
||||
} else {
|
||||
@ -124,7 +124,7 @@ mca_coll_basic_alltoallv(void *sbuf, int *scounts, int *sdisps,
|
||||
|
||||
err = MPI_Startall(nreqs, req);
|
||||
if (MPI_SUCCESS != err) {
|
||||
LAM_FREE(req);
|
||||
free(req);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -132,7 +132,7 @@ mca_coll_basic_alltoallv(void *sbuf, int *scounts, int *sdisps,
|
||||
|
||||
err = MPI_Waitall(nreqs, req, MPI_STATUSES_IGNORE);
|
||||
if (MPI_SUCCESS != err) {
|
||||
LAM_FREE(req);
|
||||
free(req);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -141,13 +141,13 @@ mca_coll_basic_alltoallv(void *sbuf, int *scounts, int *sdisps,
|
||||
for (i = 0, preq = req; i < nreqs; ++i, ++preq) {
|
||||
err = MPI_Request_free(preq);
|
||||
if (err != MPI_SUCCESS) {
|
||||
LAM_FREE(req);
|
||||
free(req);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
/* All done */
|
||||
|
||||
LAM_FREE(req);
|
||||
free(req);
|
||||
return MPI_SUCCESS;
|
||||
}
|
||||
|
@ -47,9 +47,9 @@ int mca_coll_basic_alltoallw(void *sbuf, int *scounts, int *sdisps,
|
||||
|
||||
nreqs = 2 * (size - 1);
|
||||
if (nreqs > 0) {
|
||||
req = (MPI_Request *) LAM_MALLOC(nreqs * sizeof(MPI_Request));
|
||||
req = malloc(nreqs * sizeof(MPI_Request));
|
||||
if (NULL == req) {
|
||||
LAM_FREE(req);
|
||||
free(req);
|
||||
return ENOMEM;
|
||||
}
|
||||
} else {
|
||||
@ -119,7 +119,7 @@ int mca_coll_basic_alltoallw(void *sbuf, int *scounts, int *sdisps,
|
||||
|
||||
err = MPI_Startall(nreqs, req);
|
||||
if (MPI_SUCCESS != err) {
|
||||
LAM_FREE(req);
|
||||
free(req);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -127,7 +127,7 @@ int mca_coll_basic_alltoallw(void *sbuf, int *scounts, int *sdisps,
|
||||
|
||||
err = MPI_Waitall(nreqs, req, MPI_STATUSES_IGNORE);
|
||||
if (MPI_SUCCESS != err) {
|
||||
LAM_FREE(req);
|
||||
free(req);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -136,13 +136,13 @@ int mca_coll_basic_alltoallw(void *sbuf, int *scounts, int *sdisps,
|
||||
for (i = 0, preq = req; i < nreqs; ++i, ++preq) {
|
||||
err = MPI_Request_free(preq);
|
||||
if (MPI_SUCCESS != err) {
|
||||
LAM_FREE(req);
|
||||
free(req);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
/* All done */
|
||||
|
||||
LAM_FREE(req);
|
||||
free(req);
|
||||
return MPI_SUCCESS;
|
||||
}
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "lam/constants.h"
|
||||
#include "lam/mem/malloc.h"
|
||||
#include "mpi.h"
|
||||
#include "mca/mpi/coll/coll.h"
|
||||
#include "coll_basic.h"
|
||||
@ -77,7 +76,7 @@ int mca_coll_basic_reduce_lin(void *sbuf, void *rbuf, int count,
|
||||
}
|
||||
if (MPI_SUCCESS != err) {
|
||||
if (NULL != buffer)
|
||||
LAM_FREE(buffer);
|
||||
free(buffer);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -95,7 +94,7 @@ int mca_coll_basic_reduce_lin(void *sbuf, void *rbuf, int count,
|
||||
#endif
|
||||
if (MPI_SUCCESS != err) {
|
||||
if (NULL != buffer)
|
||||
LAM_FREE(buffer);
|
||||
free(buffer);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -115,7 +114,7 @@ int mca_coll_basic_reduce_lin(void *sbuf, void *rbuf, int count,
|
||||
}
|
||||
|
||||
if (NULL != buffer)
|
||||
LAM_FREE(buffer);
|
||||
free(buffer);
|
||||
|
||||
/* All done */
|
||||
|
||||
@ -161,7 +160,7 @@ int mca_coll_basic_reduce_log(void *sbuf, void *rbuf, int count,
|
||||
err = lam_dtbuffer(dtype, count, &buf2, &origin2);
|
||||
if (MPI_SUCCESS != err) {
|
||||
if (NULL != buf1)
|
||||
LAM_FREE(buf1);
|
||||
free(buf1);
|
||||
return err;
|
||||
}
|
||||
#endif
|
||||
@ -203,9 +202,9 @@ int mca_coll_basic_reduce_log(void *sbuf, void *rbuf, int count,
|
||||
#endif
|
||||
if (MPI_SUCCESS != err) {
|
||||
if (NULL != buf1)
|
||||
LAM_FREE(buf1);
|
||||
free(buf1);
|
||||
if (NULL != buf2)
|
||||
LAM_FREE(buf2);
|
||||
free(buf2);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -234,9 +233,9 @@ int mca_coll_basic_reduce_log(void *sbuf, void *rbuf, int count,
|
||||
#endif
|
||||
if (MPI_SUCCESS != err) {
|
||||
if (NULL != buf1)
|
||||
LAM_FREE(buf1);
|
||||
free(buf1);
|
||||
if (NULL != buf2)
|
||||
LAM_FREE(buf2);
|
||||
free(buf2);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -287,9 +286,9 @@ int mca_coll_basic_reduce_log(void *sbuf, void *rbuf, int count,
|
||||
}
|
||||
|
||||
if (NULL != buf1)
|
||||
LAM_FREE(buf1);
|
||||
free(buf1);
|
||||
if (NULL != buf2)
|
||||
LAM_FREE(buf2);
|
||||
free(buf2);
|
||||
|
||||
/* All done */
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include "lam/constants.h"
|
||||
#include "lam/mem/malloc.h"
|
||||
#include "mpi.h"
|
||||
#include "mca/mpi/coll/coll.h"
|
||||
#include "coll_basic.h"
|
||||
@ -48,9 +47,9 @@ int mca_coll_basic_reduce_scatter(void *sbuf, void *rbuf, int *rcounts,
|
||||
}
|
||||
|
||||
if (0 == rank) {
|
||||
disps = (int *) LAM_MALLOC((unsigned) size * sizeof(int));
|
||||
disps = malloc((unsigned) size * sizeof(int));
|
||||
if (NULL == disps) {
|
||||
LAM_FREE(disps);
|
||||
free(disps);
|
||||
return errno;
|
||||
}
|
||||
|
||||
@ -58,7 +57,7 @@ int mca_coll_basic_reduce_scatter(void *sbuf, void *rbuf, int *rcounts,
|
||||
/* JMS Need to replace this with lam_datatype_*() functions */
|
||||
err = lam_dtbuffer(dtype, count, &buffer, &origin);
|
||||
if (MPI_SUCCESS != err) {
|
||||
LAM_FREE(disps);
|
||||
free(disps);
|
||||
return err;
|
||||
}
|
||||
#endif
|
||||
@ -73,9 +72,9 @@ int mca_coll_basic_reduce_scatter(void *sbuf, void *rbuf, int *rcounts,
|
||||
err = MPI_Reduce(sbuf, origin, count, dtype, op, 0, comm);
|
||||
if (MPI_SUCCESS != err) {
|
||||
if (NULL != disps)
|
||||
LAM_FREE(disps);
|
||||
free(disps);
|
||||
if (NULL != buffer)
|
||||
LAM_FREE(buffer);
|
||||
free(buffer);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -84,9 +83,9 @@ int mca_coll_basic_reduce_scatter(void *sbuf, void *rbuf, int *rcounts,
|
||||
err = MPI_Scatterv(origin, rcounts, disps, dtype,
|
||||
rbuf, rcounts[rank], dtype, 0, comm);
|
||||
if (NULL != disps)
|
||||
LAM_FREE(disps);
|
||||
free(disps);
|
||||
if (NULL != buffer)
|
||||
LAM_FREE(buffer);
|
||||
free(buffer);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "lam/constants.h"
|
||||
#include "lam/mem/malloc.h"
|
||||
#include "mpi.h"
|
||||
#include "mca/mpi/coll/coll.h"
|
||||
#include "coll_basic.h"
|
||||
@ -75,7 +74,7 @@ int mca_coll_basic_scan(void *sbuf, void *rbuf, int count,
|
||||
count, dtype, BLKMPISCAN, comm);
|
||||
if (MPI_SUCCESS != err) {
|
||||
if (NULL != tmpbuf)
|
||||
LAM_FREE(tmpbuf);
|
||||
free(tmpbuf);
|
||||
return err;
|
||||
}
|
||||
#endif
|
||||
@ -99,7 +98,7 @@ int mca_coll_basic_scan(void *sbuf, void *rbuf, int count,
|
||||
|
||||
if (MPI_SUCCESS != err) {
|
||||
if (NULL != tmpbuf)
|
||||
LAM_FREE(tmpbuf);
|
||||
free(tmpbuf);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -113,7 +112,7 @@ int mca_coll_basic_scan(void *sbuf, void *rbuf, int count,
|
||||
#endif
|
||||
|
||||
if (NULL != tmpbuf)
|
||||
LAM_FREE(tmpbuf);
|
||||
free(tmpbuf);
|
||||
}
|
||||
|
||||
/* Send result to next process. */
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include "mpi/file/file.h"
|
||||
#include "io_romio.h"
|
||||
#include "mpi/request/request.h"
|
||||
#include "lam/mem/malloc.h"
|
||||
|
||||
int mca_io_romio_File_read_at(MPI_File fh, MPI_Offset offset, void *buf,int count, MPI_Datatype datatype, MPI_Status *status){
|
||||
int ret;
|
||||
@ -51,7 +50,7 @@ int mca_io_romio_File_iread_at(MPI_File fh, MPI_Offset offset, void *buf, int co
|
||||
mca_io_romio_MPIO_Request romio_rq;
|
||||
|
||||
/* create MPI_request */
|
||||
rq = LAM_MALLOC(sizeof(mca_io_romio_request_t));
|
||||
rq = malloc(sizeof(mca_io_romio_request_t));
|
||||
(*request) = (lam_request_t *) rq;
|
||||
(*request)->req_type = LAM_REQUEST_IO;
|
||||
/* extract the ROMIO request */
|
||||
@ -113,7 +112,7 @@ int mca_io_romio_File_iread(MPI_File fh, void *buf, int count, MPI_Datatype data
|
||||
mca_io_romio_MPIO_Request romio_rq;
|
||||
|
||||
/* create MPI_request */
|
||||
rq = LAM_MALLOC(sizeof(mca_io_romio_request_t));
|
||||
rq = malloc(sizeof(mca_io_romio_request_t));
|
||||
(*request) = (lam_request_t *) rq;
|
||||
(*request)->req_type = LAM_REQUEST_IO;
|
||||
/* extract the ROMIO request */
|
||||
@ -154,7 +153,7 @@ int mca_io_romio_File_iread_shared(MPI_File fh, void *buf, int count, MPI_Dataty
|
||||
mca_io_romio_MPIO_Request romio_rq;
|
||||
|
||||
/* create MPI_request */
|
||||
rq = LAM_MALLOC(sizeof(mca_io_romio_request_t));
|
||||
rq = malloc(sizeof(mca_io_romio_request_t));
|
||||
(*request) = (lam_request_t *) rq;
|
||||
(*request)->req_type = LAM_REQUEST_IO;
|
||||
/* extract the ROMIO request */
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include "mpi/file/file.h"
|
||||
#include "io_romio.h"
|
||||
#include "mpi/request/request.h"
|
||||
#include "lam/mem/malloc.h"
|
||||
#include <string.h>
|
||||
|
||||
|
||||
@ -23,7 +22,7 @@ int mca_io_romio_Test(MPI_Request *request, int *flag, MPI_Status *status){
|
||||
THREAD_LOCK(&mca_io_romio_mutex);
|
||||
ret=mca_io_romio_MPIO_Test(&romio_rq, flag,status);
|
||||
if (*flag) {
|
||||
LAM_FREE(*request);
|
||||
free(*request);
|
||||
*request = MPI_REQUEST_NULL;
|
||||
}
|
||||
THREAD_UNLOCK(&mca_io_romio_mutex);
|
||||
@ -46,7 +45,7 @@ int mca_io_romio_Wait(MPI_Request *request, MPI_Status *status){
|
||||
ret=mca_io_romio_MPIO_Wait(&romio_rq, status);
|
||||
THREAD_UNLOCK(&mca_io_romio_mutex);
|
||||
|
||||
LAM_FREE(*request);
|
||||
free(*request);
|
||||
*request = MPI_REQUEST_NULL;
|
||||
return ret;
|
||||
}
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include "mpi/file/file.h"
|
||||
#include "io_romio.h"
|
||||
#include "mpi/request/request.h"
|
||||
#include "lam/mem/malloc.h"
|
||||
|
||||
|
||||
int mca_io_romio_File_write_at(MPI_File fh, MPI_Offset offset, void *buf,int count, MPI_Datatype datatype, MPI_Status *status){
|
||||
@ -54,7 +53,7 @@ int mca_io_romio_File_iwrite_at(MPI_File fh, MPI_Offset offset, void *buf,int co
|
||||
mca_io_romio_MPIO_Request romio_rq;
|
||||
|
||||
/* create MPI_request */
|
||||
rq = LAM_MALLOC(sizeof(mca_io_romio_request_t));
|
||||
rq = malloc(sizeof(mca_io_romio_request_t));
|
||||
(*request) = (lam_request_t *) rq;
|
||||
(*request)->req_type = LAM_REQUEST_IO;
|
||||
/* extract the ROMIO request */
|
||||
@ -120,7 +119,7 @@ int mca_io_romio_File_iwrite(MPI_File fh, void *buf, int count,
|
||||
|
||||
|
||||
/* create MPI_request */
|
||||
rq = LAM_MALLOC(sizeof(mca_io_romio_request_t));
|
||||
rq = malloc(sizeof(mca_io_romio_request_t));
|
||||
*request = (lam_request_t*) rq;
|
||||
(*request)->req_type = LAM_REQUEST_IO;
|
||||
/* extract the ROMIO request */
|
||||
@ -160,7 +159,7 @@ int mca_io_romio_File_iwrite_shared(MPI_File fh, void *buf, int count,
|
||||
mca_io_romio_MPIO_Request romio_rq;
|
||||
|
||||
/* create MPI_request */
|
||||
rq = LAM_MALLOC(sizeof(mca_io_romio_request_t));
|
||||
rq = malloc(sizeof(mca_io_romio_request_t));
|
||||
(*request) = (lam_request_t *) rq;
|
||||
(*request)->req_type = LAM_REQUEST_IO;
|
||||
/* extract the ROMIO request */
|
||||
|
@ -77,7 +77,7 @@ int mca_pml_base_select(mca_pml_t *selected, bool *allow_multi_user_threads,
|
||||
best_module = module;
|
||||
}
|
||||
|
||||
om = LAM_MALLOC(sizeof(opened_module_t));
|
||||
om = malloc(sizeof(opened_module_t));
|
||||
if (NULL == om) {
|
||||
return LAM_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
@ -117,7 +117,7 @@ int mca_pml_base_select(mca_pml_t *selected, bool *allow_multi_user_threads,
|
||||
module->pmlm_version.mca_module_name);
|
||||
}
|
||||
}
|
||||
LAM_FREE(om);
|
||||
free(om);
|
||||
}
|
||||
|
||||
/* This base function closes, unloads, and removes from the
|
||||
|
@ -3,7 +3,6 @@
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "lam/mem/malloc.h"
|
||||
#include "pml_ptl_array.h"
|
||||
|
||||
|
||||
@ -27,8 +26,8 @@ void mca_ptl_array_init(mca_ptl_array_t* array)
|
||||
|
||||
void mca_ptl_array_destroy(mca_ptl_array_t* array)
|
||||
{
|
||||
if(array->ptl_procs != 0)
|
||||
LAM_FREE(array->ptl_procs);
|
||||
if (array->ptl_procs != 0)
|
||||
free(array->ptl_procs);
|
||||
SUPER_DESTROY(array, &lam_object_cls);
|
||||
}
|
||||
|
||||
@ -39,12 +38,12 @@ int mca_ptl_array_reserve(mca_ptl_array_t* array, size_t size)
|
||||
if(array->ptl_reserve >= size)
|
||||
return LAM_SUCCESS;
|
||||
|
||||
procs = (mca_ptl_proc_t*)LAM_MALLOC(sizeof(mca_ptl_array_t)*size);
|
||||
procs = malloc(sizeof(mca_ptl_array_t)*size);
|
||||
if(array == 0)
|
||||
return LAM_ERR_OUT_OF_RESOURCE;
|
||||
if(array->ptl_size) {
|
||||
memcpy(procs, array->ptl_procs, array->ptl_size * sizeof(mca_ptl_proc_t));
|
||||
LAM_FREE(array->ptl_procs);
|
||||
free(array->ptl_procs);
|
||||
}
|
||||
array->ptl_procs = procs;
|
||||
array->ptl_reserve = size;
|
||||
|
@ -3,7 +3,6 @@
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "lam/mem/malloc.h"
|
||||
#include "mca/mpi/pml/pml.h"
|
||||
#include "mca/mpi/ptl/ptl.h"
|
||||
#include "mca/mpi/ptl/base/base.h"
|
||||
@ -72,8 +71,8 @@ int mca_pml_teg_add_ptls(lam_list_t *ptls)
|
||||
size_t num_ptls = lam_list_get_size(ptls);
|
||||
mca_pml_teg.teg_num_ptls = 0;
|
||||
mca_pml_teg.teg_num_ptl_modules = 0;
|
||||
mca_pml_teg.teg_ptls = (mca_ptl_t**)LAM_MALLOC(sizeof(mca_ptl_t*) * num_ptls);
|
||||
mca_pml_teg.teg_ptl_modules = (mca_ptl_base_module_t**)LAM_MALLOC(sizeof(mca_ptl_base_module_t*) * num_ptls);
|
||||
mca_pml_teg.teg_ptls = malloc(sizeof(mca_ptl_t*) * num_ptls);
|
||||
mca_pml_teg.teg_ptl_modules = malloc(sizeof(mca_ptl_base_module_t*) * num_ptls);
|
||||
if (NULL == mca_pml_teg.teg_ptls || NULL == mca_pml_teg.teg_ptl_modules)
|
||||
return LAM_ERR_OUT_OF_RESOURCE;
|
||||
|
||||
@ -117,7 +116,7 @@ int mca_pml_teg_add_procs(lam_proc_t** procs, size_t nprocs)
|
||||
if(proc_pml == 0) {
|
||||
|
||||
/* allocate pml specific proc data */
|
||||
proc_pml = (mca_pml_proc_t*)LAM_MALLOC(sizeof(mca_pml_proc_t));
|
||||
proc_pml = malloc(sizeof(mca_pml_proc_t));
|
||||
if(NULL == proc_pml) {
|
||||
lam_output(0, "mca_pml_teg_add_procs: unable to allocate resources");
|
||||
return LAM_ERR_OUT_OF_RESOURCE;
|
||||
@ -251,7 +250,7 @@ int mca_pml_teg_del_procs(lam_proc_t** procs, size_t nprocs)
|
||||
|
||||
/* do any required cleanup */
|
||||
mca_pml_teg_proc_destroy(proc_pml);
|
||||
LAM_FREE(proc_pml);
|
||||
free(proc_pml);
|
||||
proc->proc_pml = 0;
|
||||
}
|
||||
return LAM_SUCCESS;
|
||||
|
@ -3,7 +3,6 @@
|
||||
*/
|
||||
|
||||
#include "mpi.h"
|
||||
#include "lam/mem/malloc.h"
|
||||
#include "mca/mpi/pml/pml.h"
|
||||
#include "mca/mpi/ptl/ptl.h"
|
||||
#include "mca/lam/base/mca_base_param.h"
|
||||
@ -74,9 +73,9 @@ int mca_pml_teg_module_open(void)
|
||||
int mca_pml_teg_module_close(void)
|
||||
{
|
||||
if(NULL != mca_pml_teg.teg_ptl_modules)
|
||||
LAM_FREE(mca_pml_teg.teg_ptl_modules);
|
||||
free(mca_pml_teg.teg_ptl_modules);
|
||||
if(NULL != mca_pml_teg.teg_ptls)
|
||||
LAM_FREE(mca_pml_teg.teg_ptls);
|
||||
free(mca_pml_teg.teg_ptls);
|
||||
STATIC_DESTROY(mca_pml_teg.teg_recv_requests);
|
||||
STATIC_DESTROY(mca_pml_teg.teg_procs);
|
||||
return LAM_SUCCESS;
|
||||
|
@ -30,7 +30,7 @@ int mca_ptl_base_close(void)
|
||||
anymore) */
|
||||
|
||||
sm->pbsm_actions->ptl_finalize(sm->pbsm_actions);
|
||||
LAM_FREE(sm);
|
||||
free(sm);
|
||||
}
|
||||
|
||||
/* Close all remaining available modules (may be one if this is a
|
||||
|
@ -1,6 +1,9 @@
|
||||
/*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "ptl_base_comm.h"
|
||||
|
||||
|
||||
static void mca_pml_ptl_comm_init(mca_pml_comm_t* comm);
|
||||
static void mca_pml_ptl_comm_destroy(mca_pml_comm_t* comm);
|
||||
|
||||
@ -11,7 +14,7 @@ lam_class_info_t mca_pml_ptl_comm_cls = {
|
||||
(class_init_t)mca_pml_ptl_comm_init,
|
||||
(class_destroy_t)mca_pml_ptl_comm_destroy
|
||||
};
|
||||
|
||||
|
||||
static void mca_pml_ptl_comm_init(mca_pml_comm_t* comm)
|
||||
{
|
||||
SUPER_INIT(comm, &lam_object_cls);
|
||||
@ -21,13 +24,13 @@ static void mca_pml_ptl_comm_init(mca_pml_comm_t* comm)
|
||||
|
||||
static void mca_pml_ptl_comm_destroy(mca_pml_comm_t* comm)
|
||||
{
|
||||
LAM_FREE(comm->c_msg_seq);
|
||||
LAM_FREE(comm->c_next_msg_seq);
|
||||
LAM_FREE(comm->c_matching_lock);
|
||||
LAM_FREE(comm->c_unexpected_frags);
|
||||
LAM_FREE(comm->c_unexpected_frags_lock);
|
||||
LAM_FREE(comm->c_frags_cant_match);
|
||||
LAM_FREE(comm->c_specific_receives);
|
||||
free(comm->c_msg_seq);
|
||||
free(comm->c_next_msg_seq);
|
||||
free(comm->c_matching_lock);
|
||||
free(comm->c_unexpected_frags);
|
||||
free(comm->c_unexpected_frags_lock);
|
||||
free(comm->c_frags_cant_match);
|
||||
free(comm->c_specific_receives);
|
||||
lam_list_destroy(&comm->c_wild_receives);
|
||||
SUPER_DESTROY(comm, &lam_object_cls);
|
||||
}
|
||||
@ -38,45 +41,45 @@ int mca_pml_ptl_comm_init_size(mca_pml_comm_t* comm, size_t size)
|
||||
size_t i;
|
||||
|
||||
/* send message sequence-number support - sender side */
|
||||
comm->c_msg_seq = (mca_ptl_base_sequence_t*)LAM_MALLOC(sizeof(mca_ptl_base_sequence_t) * size);
|
||||
comm->c_msg_seq = malloc(sizeof(mca_ptl_base_sequence_t) * size);
|
||||
if(NULL == comm->c_msg_seq)
|
||||
return LAM_ERR_OUT_OF_RESOURCE;
|
||||
|
||||
/* send message sequence-number support - receiver side */
|
||||
comm->c_next_msg_seq = (mca_ptl_base_sequence_t*)LAM_MALLOC(sizeof(mca_ptl_base_sequence_t) * size);
|
||||
comm->c_next_msg_seq = malloc(sizeof(mca_ptl_base_sequence_t) * size);
|
||||
if(NULL == comm->c_next_msg_seq)
|
||||
return LAM_ERR_OUT_OF_RESOURCE;
|
||||
|
||||
/* matching lock */
|
||||
comm->c_matching_lock = (lam_mutex_t*)LAM_MALLOC(sizeof(lam_mutex_t) * size);
|
||||
comm->c_matching_lock = malloc(sizeof(lam_mutex_t) * size);
|
||||
if(NULL == comm->c_matching_lock)
|
||||
return LAM_ERR_OUT_OF_RESOURCE;
|
||||
for(i=0; i<size; i++)
|
||||
lam_mutex_init(comm->c_matching_lock+i);
|
||||
|
||||
/* unexpected fragments queues */
|
||||
comm->c_unexpected_frags = (lam_list_t*)LAM_MALLOC(sizeof(lam_list_t) * size);
|
||||
comm->c_unexpected_frags = malloc(sizeof(lam_list_t) * size);
|
||||
if(NULL == comm->c_unexpected_frags)
|
||||
return LAM_ERR_OUT_OF_RESOURCE;
|
||||
for(i=0; i<size; i++)
|
||||
lam_list_init(comm->c_unexpected_frags+i);
|
||||
|
||||
/* these locks are needed to avoid a probe interfering with a match */
|
||||
comm->c_unexpected_frags_lock = (lam_mutex_t*)LAM_MALLOC(sizeof(lam_mutex_t) * size);
|
||||
comm->c_unexpected_frags_lock = malloc(sizeof(lam_mutex_t) * size);
|
||||
if(NULL == comm->c_unexpected_frags_lock)
|
||||
return LAM_ERR_OUT_OF_RESOURCE;
|
||||
for(i=0; i<size; i++)
|
||||
lam_mutex_init(comm->c_unexpected_frags_lock+i);
|
||||
|
||||
/* out-of-order fragments queues */
|
||||
comm->c_frags_cant_match = (lam_list_t*)LAM_MALLOC(sizeof(lam_list_t) * size);
|
||||
comm->c_frags_cant_match = malloc(sizeof(lam_list_t) * size);
|
||||
if(NULL == comm->c_frags_cant_match)
|
||||
return LAM_ERR_OUT_OF_RESOURCE;
|
||||
for(i=0; i<size; i++)
|
||||
lam_list_init(comm->c_frags_cant_match+i);
|
||||
|
||||
/* queues of unmatched specific (source process specified) receives */
|
||||
comm->c_specific_receives = (lam_list_t*)LAM_MALLOC(sizeof(lam_list_t) * size);
|
||||
comm->c_specific_receives = malloc(sizeof(lam_list_t) * size);
|
||||
if(NULL == comm->c_specific_receives)
|
||||
return LAM_ERR_OUT_OF_RESOURCE;
|
||||
for(i=0; i<size; i++)
|
||||
|
@ -72,7 +72,7 @@ int mca_ptl_base_select(bool *allow_multi_user_threads,
|
||||
"select: init returned success");
|
||||
|
||||
for (i = 0; i < num_ptls; ++i) {
|
||||
sm = LAM_MALLOC(sizeof(mca_ptl_base_selected_module_t));
|
||||
sm = malloc(sizeof(mca_ptl_base_selected_module_t));
|
||||
if (NULL == sm) {
|
||||
return LAM_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
@ -82,7 +82,7 @@ int mca_ptl_base_select(bool *allow_multi_user_threads,
|
||||
lam_list_append(&mca_ptl_base_modules_initialized,
|
||||
(lam_list_item_t*) sm);
|
||||
}
|
||||
LAM_FREE(actions);
|
||||
free(actions);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "lam/mem/malloc.h"
|
||||
#include "lam/util/output.h"
|
||||
#include "lam/util/if.h"
|
||||
#include "mca/mpi/pml/pml.h"
|
||||
@ -40,7 +39,7 @@ mca_ptl_tcp_t mca_ptl_tcp = {
|
||||
|
||||
int mca_ptl_tcp_create(int if_index)
|
||||
{
|
||||
mca_ptl_tcp_t* ptl = (mca_ptl_tcp_t*)LAM_MALLOC(sizeof(mca_ptl_tcp_t));
|
||||
mca_ptl_tcp_t* ptl = malloc(sizeof(mca_ptl_tcp_t));
|
||||
if(NULL == ptl)
|
||||
return LAM_ERR_OUT_OF_RESOURCE;
|
||||
memcpy(ptl, &mca_ptl_tcp, sizeof(mca_ptl_tcp));
|
||||
@ -103,7 +102,7 @@ int mca_ptl_tcp_del_proc(struct mca_ptl_t* ptl, struct lam_proc_t *proc, struct
|
||||
|
||||
int mca_ptl_tcp_finalize(struct mca_ptl_t* ptl)
|
||||
{
|
||||
LAM_FREE(ptl);
|
||||
free(ptl);
|
||||
return LAM_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "lam/util/if.h"
|
||||
#include "lam/util/argv.h"
|
||||
#include "lam/util/output.h"
|
||||
#include "lam/mem/malloc.h"
|
||||
#include "mca/mpi/pml/pml.h"
|
||||
#include "mca/mpi/ptl/ptl.h"
|
||||
#include "mca/mpi/ptl/base/ptl_base_sendreq.h"
|
||||
@ -133,10 +132,10 @@ int mca_ptl_tcp_module_open(void)
|
||||
|
||||
int mca_ptl_tcp_module_close(void)
|
||||
{
|
||||
LAM_FREE(mca_ptl_tcp_module.tcp_if_include);
|
||||
LAM_FREE(mca_ptl_tcp_module.tcp_if_exclude);
|
||||
free(mca_ptl_tcp_module.tcp_if_include);
|
||||
free(mca_ptl_tcp_module.tcp_if_exclude);
|
||||
if (NULL != mca_ptl_tcp_module.tcp_ptls)
|
||||
LAM_FREE(mca_ptl_tcp_module.tcp_ptls);
|
||||
free(mca_ptl_tcp_module.tcp_ptls);
|
||||
|
||||
STATIC_DESTROY(mca_ptl_tcp_module.tcp_reactor);
|
||||
STATIC_DESTROY(mca_ptl_tcp_module.tcp_procs);
|
||||
@ -168,7 +167,7 @@ static int mca_ptl_tcp_module_create_instances(void)
|
||||
|
||||
/* allocate memory for ptls */
|
||||
mca_ptl_tcp_module.tcp_max_ptls = if_count;
|
||||
mca_ptl_tcp_module.tcp_ptls = (mca_ptl_tcp_t**)LAM_MALLOC(if_count * sizeof(mca_ptl_tcp_t*));
|
||||
mca_ptl_tcp_module.tcp_ptls = malloc(if_count * sizeof(mca_ptl_tcp_t*));
|
||||
if(NULL == mca_ptl_tcp_module.tcp_ptls)
|
||||
return LAM_ERR_OUT_OF_RESOURCE;
|
||||
|
||||
@ -260,7 +259,7 @@ static int mca_ptl_tcp_module_create_listen(void)
|
||||
static int mca_ptl_tcp_module_exchange(void)
|
||||
{
|
||||
size_t i;
|
||||
mca_ptl_tcp_addr_t *addrs = (mca_ptl_tcp_addr_t*)LAM_MALLOC
|
||||
mca_ptl_tcp_addr_t *addrs = malloc
|
||||
(mca_ptl_tcp_module.tcp_num_ptls * sizeof(mca_ptl_tcp_addr_t));
|
||||
for(i=0; i<mca_ptl_tcp_module.tcp_num_ptls; i++) {
|
||||
mca_ptl_tcp_t* ptl = mca_ptl_tcp_module.tcp_ptls[i];
|
||||
@ -270,7 +269,7 @@ static int mca_ptl_tcp_module_exchange(void)
|
||||
}
|
||||
int rc = mca_base_modex_send(&mca_ptl_tcp_module.super.ptlm_version,
|
||||
addrs, sizeof(mca_ptl_tcp_t),mca_ptl_tcp_module.tcp_num_ptls);
|
||||
LAM_FREE(addrs);
|
||||
free(addrs);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -408,7 +407,7 @@ static void mca_ptl_tcp_module_recv_handler(void* user, int sd)
|
||||
|
||||
/* recv the identifier */
|
||||
size = ntohl(size);
|
||||
guid = LAM_MALLOC(size);
|
||||
guid = malloc(size);
|
||||
if(guid == 0) {
|
||||
close(sd);
|
||||
return;
|
||||
|
@ -270,12 +270,12 @@ static int mca_ptl_tcp_peer_recv_connect_ack(mca_ptl_base_peer_t* ptl_peer)
|
||||
if(mca_ptl_tcp_peer_recv_blocking(ptl_peer, &size_n, sizeof(size_n)) != size_n)
|
||||
return LAM_ERR_UNREACH;
|
||||
size_h = ntohl(size_n);
|
||||
guid = LAM_MALLOC(size_h);
|
||||
guid = malloc(size_h);
|
||||
if(NULL == guid)
|
||||
return LAM_ERR_OUT_OF_RESOURCE;
|
||||
|
||||
if(mca_ptl_tcp_peer_recv_blocking(ptl_peer, guid, size_h) != size_h) {
|
||||
LAM_FREE(guid);
|
||||
free(guid);
|
||||
return LAM_ERR_UNREACH;
|
||||
}
|
||||
|
||||
|
@ -48,9 +48,9 @@ void mca_ptl_tcp_proc_destroy(mca_ptl_tcp_proc_t* proc)
|
||||
|
||||
/* release resources */
|
||||
if(NULL != proc->proc_peers)
|
||||
LAM_FREE(proc->proc_peers);
|
||||
free(proc->proc_peers);
|
||||
if(NULL != proc->proc_guid)
|
||||
LAM_FREE(proc->proc_guid);
|
||||
free(proc->proc_guid);
|
||||
SUPER_DESTROY(proc, &lam_list_item_cls);
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ mca_ptl_tcp_proc_t* mca_ptl_tcp_proc_create(lam_proc_t* lam_proc)
|
||||
|
||||
/* build a unique identifier (of arbitrary size) to represent the proc */
|
||||
ptl_proc->proc_guid_size = size + sizeof(uint32_t);
|
||||
ptl_proc->proc_guid = LAM_MALLOC(ptl_proc->proc_guid_size);
|
||||
ptl_proc->proc_guid = malloc(ptl_proc->proc_guid_size);
|
||||
if(ptl_proc->proc_guid == 0) {
|
||||
OBJ_RELEASE(ptl_proc);
|
||||
return 0;
|
||||
@ -105,7 +105,7 @@ mca_ptl_tcp_proc_t* mca_ptl_tcp_proc_create(lam_proc_t* lam_proc)
|
||||
|
||||
/* allocate space for peer array - one for each exported address */
|
||||
ptl_proc->proc_peers = (mca_ptl_base_peer_t**)
|
||||
LAM_MALLOC(ptl_proc->proc_addr_count * sizeof(mca_ptl_base_peer_t*));
|
||||
malloc(ptl_proc->proc_addr_count * sizeof(mca_ptl_base_peer_t*));
|
||||
if(NULL == ptl_proc->proc_peers) {
|
||||
OBJ_RELEASE(ptl_proc);
|
||||
return NULL;
|
||||
|
@ -126,7 +126,7 @@ static bool mca_ptl_tcp_recv_frag_match(mca_ptl_tcp_recv_frag_t* frag, int sd)
|
||||
|
||||
/* match was not made - so allocate buffer for eager send */
|
||||
if(NULL == frag->super.frag_request) {
|
||||
frag->frag_addr = (unsigned char*)LAM_MALLOC(frag->frag_header.hdr_frag.hdr_frag_length);
|
||||
frag->frag_addr = malloc(frag->frag_header.hdr_frag.hdr_frag_length);
|
||||
frag->frag_size = frag->frag_header.hdr_frag.hdr_frag_length;
|
||||
} else {
|
||||
frag->frag_addr = (unsigned char*)frag->super.super.frag_addr;
|
||||
@ -219,9 +219,9 @@ static bool mca_ptl_tcp_recv_frag_discard(mca_ptl_tcp_recv_frag_t* frag, int sd)
|
||||
{
|
||||
int cnt = -1;
|
||||
while(cnt < 0) {
|
||||
void *rbuf = LAM_MALLOC(frag->frag_header.hdr_frag.hdr_frag_length - frag->frag_msg_cnt);
|
||||
void *rbuf = malloc(frag->frag_header.hdr_frag.hdr_frag_length - frag->frag_msg_cnt);
|
||||
cnt = recv(sd, rbuf, frag->frag_header.hdr_frag.hdr_frag_length - frag->frag_msg_cnt, 0);
|
||||
LAM_FREE(rbuf);
|
||||
free(rbuf);
|
||||
if(cnt == 0) {
|
||||
mca_ptl_tcp_peer_close(frag->frag_peer);
|
||||
lam_free_list_return(&mca_ptl_tcp_module.tcp_recv_frags, (lam_list_item_t*)frag);
|
||||
@ -244,6 +244,3 @@ static bool mca_ptl_tcp_recv_frag_discard(mca_ptl_tcp_recv_frag_t* frag, int sd)
|
||||
frag->frag_msg_cnt += cnt;
|
||||
return (frag->frag_msg_cnt >= frag->frag_header.hdr_frag.hdr_frag_length);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "lam/stdint.h"
|
||||
#include "lam/threads/mutex.h"
|
||||
#include "lam/util/output.h"
|
||||
#include "mpi.h"
|
||||
#include "mpi/group/group.h"
|
||||
#include "mca/mpi/coll/coll.h"
|
||||
@ -51,7 +52,7 @@ static inline lam_communicator_t *lam_comm_lookup(uint32_t cid)
|
||||
extern lam_communicator_t **lam_mpi_comm_array;
|
||||
#ifdef LAM_ENABLE_DEBUG
|
||||
extern uint32_t lam_mpi_comm_array_size;
|
||||
if(cid >= lam_mpi_comm_array_size) {
|
||||
if (cid >= lam_mpi_comm_array_size) {
|
||||
lam_output(0, "lam_comm_lookup: invalid communicator index (%d)", cid);
|
||||
return (lam_communicator_t *) NULL;
|
||||
}
|
||||
|
@ -38,13 +38,13 @@ void lam_info_destroy(lam_info_t *info) {
|
||||
*/
|
||||
void lam_info_entry_init(lam_info_entry_t *entry) {
|
||||
SUPER_INIT(entry, lam_list_item_cls.cls_parent);
|
||||
LAM_MEM_ZERO (entry->ie_key);
|
||||
memset(entry->ie_key, 0, sizeof(entry->ie_key));
|
||||
entry->ie_key[MPI_MAX_INFO_KEY] = 0;
|
||||
}
|
||||
|
||||
void lam_info_entry_destroy(lam_info_entry_t *entry) {
|
||||
SUPER_DESTROY(entry, lam_list_item_cls.cls_parent);
|
||||
if (NULL != entry->ie_value) {
|
||||
LAM_FREE(entry->ie_value);
|
||||
free(entry->ie_value);
|
||||
}
|
||||
}
|
||||
|
@ -5,10 +5,11 @@
|
||||
#ifndef LAM_INFO_H
|
||||
#define LAM_INFO_H
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "mpi.h"
|
||||
#include "lam/lfc/list.h"
|
||||
#include "lam/lam.h"
|
||||
#include <string.h>
|
||||
|
||||
|
||||
/**
|
||||
|
@ -81,7 +81,7 @@ int MPI_Info_set(MPI_Info info, char *key, char *value) {
|
||||
* 3. Store the (key, value) pair
|
||||
*/
|
||||
|
||||
new_value = (char *) LAM_MALLOC(value_length * sizeof(char));
|
||||
new_value = malloc(value_length * sizeof(char));
|
||||
if (NULL == new_value) {
|
||||
printf ("Unable to malloc memory for new (key, value) pair\n");
|
||||
return MPI_ERR_SYSRESOURCE;
|
||||
@ -94,7 +94,7 @@ int MPI_Info_set(MPI_Info info, char *key, char *value) {
|
||||
/*
|
||||
* key already exists. remove the value associated with it
|
||||
*/
|
||||
LAM_FREE (old_info->ie_value);
|
||||
free(old_info->ie_value);
|
||||
old_info->ie_value = new_value;
|
||||
} else {
|
||||
new_info = OBJ_CREATE(lam_info_entry_t, &lam_info_entry_cls);
|
||||
|
@ -12,6 +12,9 @@ list_test_SOURCES = list_test.c
|
||||
list_test_LDADD = \
|
||||
$(top_builddir)/src/lam/lfc/list.lo \
|
||||
$(top_builddir)/src/lam/lfc/object.lo \
|
||||
$(top_builddir)/src/lam/mem/malloc.lo \
|
||||
$(top_builddir)/src/lam/util/output.lo \
|
||||
$(top_builddir)/src/lam/threads/mutex.lo \
|
||||
$(top_builddir)/test/support/libsupport.la
|
||||
list_test_DEPENDENCIES = $(list_test_LDADD)
|
||||
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user