Skip to content

Commit

Permalink
ECC-1952: C API: Deprecate functions
Browse files Browse the repository at this point in the history
  • Loading branch information
shahramn committed Oct 24, 2024
1 parent b8aedee commit 1c45f77
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/eccodes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -601,16 +601,20 @@ void codes_context_set_data_quality_checks(codes_context* c, int val)

void codes_context_set_memory_proc(codes_context* c, grib_malloc_proc p_malloc, grib_free_proc p_free, grib_realloc_proc p_realloc)
{
// This function is deprecated and will later be removed
grib_context_set_memory_proc(c, p_malloc, p_free, p_realloc);
}
void codes_context_set_persistent_memory_proc(codes_context* c, grib_malloc_proc p_malloc, grib_free_proc p_free)
{
// This function is deprecated and will later be removed
grib_context_set_persistent_memory_proc(c, p_malloc, p_free);
}
void codes_context_set_buffer_memory_proc(codes_context* c, grib_malloc_proc p_malloc, grib_free_proc p_free, grib_realloc_proc p_realloc)
{
// This function is deprecated and will later be removed
grib_context_set_buffer_memory_proc(c, p_malloc, p_free, p_realloc);
}

void codes_context_set_print_proc(codes_context* c, grib_print_proc p_print)
{
grib_context_set_print_proc(c, p_print);
Expand Down
8 changes: 4 additions & 4 deletions src/eccodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,7 @@ typedef int (*codes_data_eof_proc)(const codes_context* c, void* stream);
/**
* Get the static default context
*
* @return the default context, NULL it the context is not available
* @return the default context, NULL if the context is not available
*/
codes_context* codes_context_get_default(void);

Expand Down Expand Up @@ -1186,7 +1186,7 @@ void codes_context_set_data_quality_checks(codes_context* c, int val);
* @param p_realloc : the memory reallocation procedure to be set @see codes_realloc_proc
*/
void codes_context_set_memory_proc(codes_context* c, codes_malloc_proc p_malloc,
codes_free_proc p_free, codes_realloc_proc p_realloc);
codes_free_proc p_free, codes_realloc_proc p_realloc) ECCODES_DEPRECATED;

/**
* Sets memory procedures of the context for persistent data
Expand All @@ -1196,7 +1196,7 @@ void codes_context_set_memory_proc(codes_context* c, codes_malloc_proc p_malloc,
* @param gribfree : the memory freeing procedure to be set @see codes_free_proc
*/
void codes_context_set_persistent_memory_proc(codes_context* c, codes_malloc_proc p_malloc,
codes_free_proc p_free);
codes_free_proc p_free) ECCODES_DEPRECATED;

/**
* Sets memory procedures of the context for large buffers
Expand All @@ -1207,7 +1207,7 @@ void codes_context_set_persistent_memory_proc(codes_context* c, codes_malloc_pro
* @param p_free : the memory reallocation procedure to be set @see codes_realloc_proc
*/
void codes_context_set_buffer_memory_proc(codes_context* c, codes_malloc_proc p_malloc,
codes_free_proc p_free, codes_realloc_proc p_realloc);
codes_free_proc p_free, codes_realloc_proc p_realloc) ECCODES_DEPRECATED;

/**
* Sets the context printing procedure used for user interaction
Expand Down
2 changes: 1 addition & 1 deletion src/grib_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,7 @@ typedef int (*grib_data_eof_proc)(const grib_context* c, void* stream);
/**
* Get the static default context
*
* @return the default context, NULL it the context is not available
* @return the default context, NULL if the context is not available
*/
grib_context* grib_context_get_default(void);

Expand Down
3 changes: 3 additions & 0 deletions src/grib_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1027,19 +1027,22 @@ void* grib_context_buffer_malloc_clear(const grib_context* c, size_t size)

void grib_context_set_memory_proc(grib_context* c, grib_malloc_proc m, grib_free_proc f, grib_realloc_proc r)
{
fprintf(stderr, "Warning: The %s function is deprecated and will be removed later.\n", __func__);
c->free_mem = f;
c->alloc_mem = m;
c->realloc_mem = r;
}

void grib_context_set_persistent_memory_proc(grib_context* c, grib_malloc_proc m, grib_free_proc f)
{
fprintf(stderr, "Warning: The %s function is deprecated and will be removed later.\n", __func__);
c->free_persistent_mem = f;
c->alloc_persistent_mem = m;
}

void grib_context_set_buffer_memory_proc(grib_context* c, grib_malloc_proc m, grib_free_proc f, grib_realloc_proc r)
{
fprintf(stderr, "Warning: The %s function is deprecated and will be removed later.\n", __func__);
c->free_buffer_mem = f;
c->alloc_buffer_mem = m;
c->realloc_buffer_mem = r;
Expand Down

0 comments on commit 1c45f77

Please sign in to comment.