Skip to content

Commit

Permalink
[datapipe] Drop unused DATAPIPE_DATA_DYNAMIC enumeration value. JB#22475
Browse files Browse the repository at this point in the history
No datapipes utilize DATAPIPE_DATA_DYNAMIC, so all special case
code related to it can be removed.

Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
  • Loading branch information
spiiroin committed Sep 19, 2018
1 parent b02651f commit 930de62
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 23 deletions.
23 changes: 1 addition & 22 deletions datapipe.c
Expand Up @@ -527,15 +527,6 @@ datapipe_exec_filters(datapipe_t *const datapipe,
i)) != NULL; i++) {
gpointer tmp = filter(data);

if( datapipe->dp_free_cache == DATAPIPE_DATA_DYNAMIC ) {
/* When dealing with dynamic data, the transitional
* values need to be released - except for the value
* that is cached at the datapipe
*/
if( tmp != data && data != datapipe->dp_cached_data )
g_free(data);
}

data = tmp;
}

Expand Down Expand Up @@ -600,9 +591,6 @@ gconstpointer datapipe_exec_full(datapipe_t *const datapipe,

/* Optionally cache the value at the input stage */
if( cache_indata & (DATAPIPE_CACHE_INDATA|DATAPIPE_CACHE_OUTDATA) ) {
if( datapipe->dp_free_cache == DATAPIPE_DATA_DYNAMIC &&
datapipe->dp_cached_data != indata )
g_free(datapipe->dp_cached_data);
datapipe->dp_cached_data = indata;
}

Expand All @@ -618,10 +606,6 @@ gconstpointer datapipe_exec_full(datapipe_t *const datapipe,

/* Optionally cache the value at the output stage */
if( cache_indata & DATAPIPE_CACHE_OUTDATA ) {
if( datapipe->dp_free_cache == DATAPIPE_DATA_DYNAMIC &&
datapipe->dp_cached_data != outdata )
g_free(datapipe->dp_cached_data);

datapipe->dp_cached_data = (gpointer)outdata;
}

Expand Down Expand Up @@ -872,8 +856,7 @@ datapipe_remove_output_trigger(datapipe_t *const datapipe,
* @param datapipe The datapipe to manipulate
* @param read_only DATAPIPE_FILTERING_DENIED if the datapipe is read only,
* DATAPIPE_FILTERING_ALLOWED if it's read/write
* @param free_cache DATAPIPE_DATA_DYNAMIC if the cached data needs to be freed,
* DATAPIPE_DATA_LITERAL if the cache data should not be freed
* @param free_cache DATAPIPE_DATA_LITERAL if the cache data should not be freed
* @param datasize Pass size of memory to copy,
* or 0 if only passing pointers or data as pointers
* @param initial_data Initial cache content
Expand Down Expand Up @@ -939,10 +922,6 @@ datapipe_free(datapipe_t *const datapipe)
"still has registered output_trigger(s)");
}

if (datapipe->dp_free_cache == DATAPIPE_DATA_DYNAMIC) {
g_free(datapipe->dp_cached_data);
}

EXIT:
return;
}
Expand Down
1 change: 0 additions & 1 deletion datapipe.h
Expand Up @@ -72,7 +72,6 @@ typedef enum {
*/
typedef enum {
DATAPIPE_DATA_LITERAL = FALSE, /**< Don't free the cache */
DATAPIPE_DATA_DYNAMIC = TRUE, /**< Free the cache */
} datapipe_data_t;

/**
Expand Down

0 comments on commit 930de62

Please sign in to comment.