From 1c45f774de6d6168d768878aad989efe443eca89 Mon Sep 17 00:00:00 2001 From: shahramn Date: Thu, 24 Oct 2024 17:00:14 +0100 Subject: [PATCH] ECC-1952: C API: Deprecate functions --- src/eccodes.cc | 4 ++++ src/eccodes.h | 8 ++++---- src/grib_api.h | 2 +- src/grib_context.cc | 3 +++ 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/eccodes.cc b/src/eccodes.cc index 01cec1142..d26644062 100644 --- a/src/eccodes.cc +++ b/src/eccodes.cc @@ -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); diff --git a/src/eccodes.h b/src/eccodes.h index 782542a24..46a048d43 100644 --- a/src/eccodes.h +++ b/src/eccodes.h @@ -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); @@ -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 @@ -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 @@ -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 diff --git a/src/grib_api.h b/src/grib_api.h index 1770032c0..4c633043f 100644 --- a/src/grib_api.h +++ b/src/grib_api.h @@ -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); diff --git a/src/grib_context.cc b/src/grib_context.cc index b2119aa9a..4d5b92242 100644 --- a/src/grib_context.cc +++ b/src/grib_context.cc @@ -1027,6 +1027,7 @@ 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; @@ -1034,12 +1035,14 @@ void grib_context_set_memory_proc(grib_context* c, grib_malloc_proc m, grib_free 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;