Revert "Move macros to internal header" accepted/tizen_5.5_unified_wearable_hotfix tizen_5.5_wearable_hotfix accepted/tizen/5.5/unified/20200304.123816 accepted/tizen/5.5/unified/wearable/hotfix/20201027.114727 submit/tizen_5.5/20200303.094809 submit/tizen_5.5_wearable_hotfix/20201026.184303
authorHwankyu Jhun <h.jhun@samsung.com>
Tue, 3 Mar 2020 09:46:09 +0000 (18:46 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Tue, 3 Mar 2020 09:46:12 +0000 (18:46 +0900)
This reverts commit c132ce1d425cdfb1402436aaed38e7a9f3f5da66.

Change-Id: I899940b780706f5e7da49b760cb55ca86ed5b592

include/bundle.h
include/bundle_internal.h
src/bundle.c
src/bundle_json.c
src/bundle_private.h [deleted file]
src/keyval_array.c

index ada31581d6dea79afea78b58001bf3e5618a2c08..b51aa69414e8a4eae2ad6951ab856c8b9fa4b123 100644 (file)
 extern "C" {
 # endif
 
+#define API __attribute__((visibility("default")))
+#define likely(x) __builtin_expect(x, 1)
+#define unlikely(x) __builtin_expect(x, 0)
+
 /**
  * @brief Enumeration for error codes of Bundle.
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
@@ -126,7 +130,7 @@ typedef void (*bundle_iterator_t) (const char *key, const int type, const bundle
  bundle_free(b); // Free the bundle
  * @endcode
  */
-bundle *bundle_create(void);
+API bundle *bundle_create(void);
 
 
 /**
@@ -145,7 +149,7 @@ bundle *bundle_create(void);
  bundle_free(b); // Free the bundle
  * @endcode
  */
-int bundle_free(bundle *b);
+API int bundle_free(bundle *b);
 
 
 /**
@@ -171,7 +175,7 @@ int bundle_free(bundle *b);
  bundle_free(b);
  * @endcode
  */
-int bundle_add_str_array(bundle *b, const char *key, const char **str_array, const int len);
+API int bundle_add_str_array(bundle *b, const char *key, const char **str_array, const int len);
 
 
 /**
@@ -194,7 +198,7 @@ int bundle_add_str_array(bundle *b, const char *key, const char **str_array, con
  bundle_free(b);
  * @endcode
  */
-int bundle_del(bundle *b, const char *key);
+API int bundle_del(bundle *b, const char *key);
 
 
 /**
@@ -228,7 +232,7 @@ int bundle_del(bundle *b, const char *key);
  bundle_free(b);
  * @endcode
  */
-const char **bundle_get_str_array(bundle *b, const char *key, int *len);
+API const char **bundle_get_str_array(bundle *b, const char *key, int *len);
 
 
 /**
@@ -249,7 +253,7 @@ const char **bundle_get_str_array(bundle *b, const char *key, int *len);
  bundle_free(b);
  * @endcode
  */
-int bundle_get_count(bundle *b);
+API int bundle_get_count(bundle *b);
 
 
 /**
@@ -265,7 +269,7 @@ int bundle_get_count(bundle *b);
  * @pre @a b must be a valid bundle object.
  * @see bundle_type_t
  */
-int bundle_get_type(bundle *b, const char *key);
+API int bundle_get_type(bundle *b, const char *key);
 
 
 /**
@@ -290,7 +294,7 @@ int bundle_get_type(bundle *b, const char *key);
  bundle_free(b_dup);
  * @endcode
  */
-bundle *bundle_dup(bundle *b_from);
+API bundle *bundle_dup(bundle *b_from);
 
 
 /**
@@ -346,7 +350,7 @@ bundle *bundle_dup(bundle *b_from);
  }
  * @endcode
  */
-void bundle_foreach(bundle *b, bundle_iterator_t iter, void *user_data);
+API void bundle_foreach(bundle *b, bundle_iterator_t iter, void *user_data);
 
 
 /**
@@ -361,7 +365,7 @@ void bundle_foreach(bundle *b, bundle_iterator_t iter, void *user_data);
  * @pre @a kv must be a valid bundle_keyval_t object.
  * @see bundle_foreach()
  */
-int bundle_keyval_get_type(bundle_keyval_t *kv);
+API int bundle_keyval_get_type(bundle_keyval_t *kv);
 
 
 /**
@@ -377,7 +381,7 @@ int bundle_keyval_get_type(bundle_keyval_t *kv);
  * @pre @a kv must be a valid bundle_keyval_t object.
  * @see bundle_foreach()
  */
-int bundle_keyval_type_is_array(bundle_keyval_t *kv);
+API int bundle_keyval_type_is_array(bundle_keyval_t *kv);
 
 
 /**
@@ -394,7 +398,7 @@ int bundle_keyval_type_is_array(bundle_keyval_t *kv);
  * @post @a val and @a size are set.
  * @see bundle_foreach()
  */
-int bundle_keyval_get_basic_val(bundle_keyval_t *kv, void **val, size_t *size);
+API int bundle_keyval_get_basic_val(bundle_keyval_t *kv, void **val, size_t *size);
 
 
 /**
@@ -411,7 +415,7 @@ int bundle_keyval_get_basic_val(bundle_keyval_t *kv, void **val, size_t *size);
  * @post @a array_val, @a array_len, @a array_element_size are set.
  * @see bundle_foreach()
  */
-int bundle_keyval_get_array_val(bundle_keyval_t *kv, void ***array_val, unsigned int *array_len, size_t **array_element_size);
+API int bundle_keyval_get_array_val(bundle_keyval_t *kv, void ***array_val, unsigned int *array_len, size_t **array_element_size);
 
 
 /**
@@ -437,7 +441,7 @@ int bundle_keyval_get_array_val(bundle_keyval_t *kv, void ***array_val, unsigned
  bundle_free(b);
  * @endcode
  */
-int bundle_encode(bundle *b, bundle_raw **r, int *len);
+API int bundle_encode(bundle *b, bundle_raw **r, int *len);
 
 
 /**
@@ -470,7 +474,7 @@ int bundle_encode(bundle *b, bundle_raw **r, int *len);
  bundle_free(b_dup);
  * @endcode
  */
-bundle *bundle_decode(const bundle_raw *r, const int len);
+API bundle *bundle_decode(const bundle_raw *r, const int len);
 
 
 /**
@@ -494,7 +498,7 @@ bundle *bundle_decode(const bundle_raw *r, const int len);
  bundle_free(b);
  * @endcode
  */
-int bundle_add_str(bundle *b, const char *key, const char *str);
+API int bundle_add_str(bundle *b, const char *key, const char *str);
 
 
 /**
@@ -524,7 +528,7 @@ int bundle_add_str(bundle *b, const char *key, const char *str);
  bundle_free(b);
  * @endcode
  */
-int bundle_add_byte(bundle *b, const char *key, const void *bytes, const size_t size);
+API int bundle_add_byte(bundle *b, const char *key, const void *bytes, const size_t size);
 
 
 /**
@@ -553,7 +557,7 @@ int bundle_add_byte(bundle *b, const char *key, const void *bytes, const size_t
  v = NULL;
  * @endcode
  */
-int bundle_get_str(bundle *b, const char *key, char **str);
+API int bundle_get_str(bundle *b, const char *key, char **str);
 
 
 /**
@@ -588,7 +592,7 @@ int bundle_get_str(bundle *b, const char *key, char **str);
  bundle_free(b); // After freeing b, v and n become a dangling pointer
  * @endcode
  */
-int bundle_get_byte(bundle *b, const char *key, void **bytes, size_t *size);
+API int bundle_get_byte(bundle *b, const char *key, void **bytes, size_t *size);
 
 /**
  * @brief Adds an 'array of byte sequences' type key-value pair into a bundle.
@@ -609,7 +613,7 @@ int bundle_get_byte(bundle *b, const char *key, void **bytes, size_t *size);
  * @see bundle_get_byte_array()
  * @see bundle_set_byte_array_element()
  */
-int bundle_add_byte_array(bundle *b, const char *key, const unsigned int len);
+API int bundle_add_byte_array(bundle *b, const char *key, const unsigned int len);
 
 /**
  * @brief Sets an element of an array of byte sequences.
@@ -632,7 +636,7 @@ int bundle_add_byte_array(bundle *b, const char *key, const unsigned int len);
  * @see bundle_add_byte_array()
  * @see bundle_get_byte_array()
  */
-int bundle_set_byte_array_element(bundle *b, const char *key, const unsigned int idx, const void *bytes, const size_t size);
+API int bundle_set_byte_array_element(bundle *b, const char *key, const unsigned int idx, const void *bytes, const size_t size);
 
 /**
  * @brief Gets the array of byte sequences with the given key.
@@ -654,7 +658,7 @@ int bundle_set_byte_array_element(bundle *b, const char *key, const unsigned int
  * @see bundle_add_byte_array()
  * @see bundle_set_byte_array_element()
 */
-int bundle_get_byte_array(bundle *b, const char *key, void ***byte_array, unsigned int *len, unsigned int **array_element_size);
+API int bundle_get_byte_array(bundle *b, const char *key, void ***byte_array, unsigned int *len, unsigned int **array_element_size);
 
 #ifdef __cplusplus
 }
index a1b86768dd0c464a1b9ae8e6578124a48ecb6a7a..90e76b6ea66619ecff269f39b3131ba2bf714e5a 100644 (file)
@@ -27,7 +27,7 @@
  * @{
  */
 
-#include <bundle.h>
+#include "bundle.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -62,7 +62,7 @@ typedef void (*bundle_iterate_cb_t) (const char *key, const char *val, void *dat
  bundle_free(b);
  @endcode
  */
-int bundle_add(bundle *b, const char *key, const char *val);
+API int bundle_add(bundle *b, const char *key, const char *val);
 
 /**
  * @brief Gets a value with a given key.
@@ -88,7 +88,7 @@ int bundle_add(bundle *b, const char *key, const char *val);
  val = NULL;
  @endcode
  */
-const char *bundle_get_val(bundle *b, const char *key);
+API const char *bundle_get_val(bundle *b, const char *key);
 
 /**
  * @brief Iterates a callback function for each key-value pairs in a given bundle.
@@ -119,7 +119,7 @@ const char *bundle_get_val(bundle *b, const char *key);
  }
  @endcode
  */
-void bundle_iterate(bundle *b, bundle_iterate_cb_t callback, void *cb_data);
+API void bundle_iterate(bundle *b, bundle_iterate_cb_t callback, void *cb_data);
 
 /**
  * @brief Determines whether the type of a key-value pair is measurable.
@@ -134,7 +134,7 @@ void bundle_iterate(bundle *b, bundle_iterate_cb_t callback, void *cb_data);
  * @pre @a kv must be a valid bundle_keyval_t object.
  * @see bundle_foreach()
  */
-int bundle_keyval_type_is_measurable(bundle_keyval_t *kv);
+API int bundle_keyval_type_is_measurable(bundle_keyval_t *kv);
 
 /**
  * @brief Duplicates key-value pair.
@@ -144,7 +144,7 @@ int bundle_keyval_type_is_measurable(bundle_keyval_t *kv);
  * @retval @c NULL - Failure
  * @pre @a kv must be a valid bundle_keyval_t object.
  */
-bundle_keyval_t *bundle_keyval_dup(const bundle_keyval_t *kv);
+API bundle_keyval_t *bundle_keyval_dup(const bundle_keyval_t *kv);
 
 /**
  * @brief Frees the encoded rawdata.
@@ -156,7 +156,7 @@ bundle_keyval_t *bundle_keyval_dup(const bundle_keyval_t *kv);
  * @pre @a r is a valid rawdata generated by bundle_encode().
  * @see bundle_encode()
  */
-int bundle_free_encoded_rawdata(bundle_raw **r);
+API int bundle_free_encoded_rawdata(bundle_raw **r);
 
 /**
  * @brief Encodes a bundle to the bundle_raw format.
@@ -181,7 +181,7 @@ int bundle_free_encoded_rawdata(bundle_raw **r);
  bundle_free(b);
  @endcode
  */
-int bundle_encode_raw(bundle *b, bundle_raw **r, int *len);
+API int bundle_encode_raw(bundle *b, bundle_raw **r, int *len);
 
 /**
  * @brief Deserializes bundle_raw and gets a bundle object.
@@ -211,7 +211,7 @@ int bundle_encode_raw(bundle *b, bundle_raw **r, int *len);
  bundle_free(b_dup);
  @endcode
  */
-bundle *bundle_decode_raw(const bundle_raw *r, const int len);
+API bundle *bundle_decode_raw(const bundle_raw *r, const int len);
 
 /**
  * @brief Exports bundle to @a argv.
@@ -248,7 +248,7 @@ bundle *bundle_decode_raw(const bundle_raw *r, const int len);
  bundle_free(b);
  @endcode
  */
-int bundle_export_to_argv(bundle *b, char ***argv);
+API int bundle_export_to_argv(bundle *b, char ***argv);
 
 /**
  * @brief Frees the exported @a argv.
@@ -278,7 +278,7 @@ int bundle_export_to_argv(bundle *b, char ***argv);
  bundle_free(b);
  @endcode
  */
-int bundle_free_exported_argv(int argc, char ***argv);
+API int bundle_free_exported_argv(int argc, char ***argv);
 
 /**
  * @brief Imports a bundle from @a argv.
@@ -306,7 +306,7 @@ int bundle_free_exported_argv(int argc, char ***argv);
  }
  @endcode
  */
-bundle *bundle_import_from_argv(int argc, char **argv);
+API bundle *bundle_import_from_argv(int argc, char **argv);
 
 /**
  * @brief Sets a value of string array elements.
@@ -338,7 +338,7 @@ bundle *bundle_import_from_argv(int argc, char **argv);
  bundle_free(b);
  @endcode
  */
-int bundle_set_str_array_element(bundle *b, const char *key, const unsigned int idx, const char *val);
+API int bundle_set_str_array_element(bundle *b, const char *key, const unsigned int idx, const char *val);
 
 /**
  * @brief Creates a JSON data from bundle.
@@ -368,7 +368,7 @@ int bundle_set_str_array_element(bundle *b, const char *key, const unsigned int
  free(json);
  @endcode
  */
-int bundle_to_json(bundle *b, char **json);
+API int bundle_to_json(bundle *b, char **json);
 
 /**
  * @breif Creates a bundle object from json.
@@ -392,7 +392,7 @@ int bundle_to_json(bundle *b, char **json);
  bundle_free(b);
  @endcode
  */
-int bundle_from_json(const char *json, bundle **b);
+API int bundle_from_json(const char *json, bundle **b);
 
 /**
  * @breif Compares the bundle 1, 2.
@@ -404,7 +404,7 @@ int bundle_from_json(const char *json, bundle **b);
  * @retval @c -1 Invalid parameter
  * @retval @c 1 It is not identical
  */
-int bundle_compare(bundle *b1, bundle *b2);
+API int bundle_compare(bundle *b1, bundle *b2);
 
 /**
  * @brief Initializes a byte array type key-value pair into a bundle.
@@ -423,7 +423,7 @@ int bundle_compare(bundle *b1, bundle *b2);
  *
  * @see bundle_set_byte_array_element()
  */
-int bundle_init_byte_array(bundle *b, const char *key, const unsigned int len);
+API int bundle_init_byte_array(bundle *b, const char *key, const unsigned int len);
 
 #ifdef __cplusplus
 }
index 0ffa3fb352f9ed4b9cada87814ae91f9aa84f9c2..333536ac7c28098ec1e95d81823f3a7d987a8df0 100644 (file)
 
 #include "bundle.h"
 #include "bundle_internal.h"
-#include "bundle_log.h"
-#include "bundle_private.h"
 #include "keyval.h"
 #include "keyval_array.h"
 #include "keyval_type.h"
+#include "bundle_log.h"
 
 #define CHECKSUM_LENGTH 32
 #define TAG_IMPORT_EXPORT_CHECK "`zaybxcwdveuftgsh`"
@@ -168,7 +167,7 @@ static void _bundle_global_init(void)
 }
 
 /* APIs */
-API bundle *bundle_create(void)
+bundle *bundle_create(void)
 {
        bundle *b = NULL;
 
@@ -189,7 +188,7 @@ exception:
        return NULL;
 }
 
-API int bundle_free(bundle *b)
+int bundle_free(bundle *b)
 {
        keyval_t *kv;
        keyval_t *tmp_kv;
@@ -213,25 +212,25 @@ API int bundle_free(bundle *b)
        return BUNDLE_ERROR_NONE;
 }
 
-API int bundle_add_str(bundle *b, const char *key, const char *str)
+int bundle_add_str(bundle *b, const char *key, const char *str)
 {
        if (!str)
                return BUNDLE_ERROR_INVALID_PARAMETER;
        return _bundle_add_kv(b, key, str, strlen(str) + 1, BUNDLE_TYPE_STR, 1);
 }
 
-API int bundle_get_str(bundle *b, const char *key, char **str)
+int bundle_get_str(bundle *b, const char *key, char **str)
 {
        return _bundle_get_val(b, key, BUNDLE_TYPE_STR, (void **)str,
                        NULL, NULL, NULL);
 }
 
-API int bundle_add(bundle *b, const char *key, const char *val)
+int bundle_add(bundle *b, const char *key, const char *val)
 {
        return bundle_add_str(b, key, val);
 }
 
-API int bundle_del(bundle *b, const char *key)
+int bundle_del(bundle *b, const char *key)
 {
        keyval_t *kv;
        keyval_t *prev_kv = NULL;
@@ -265,7 +264,7 @@ API int bundle_del(bundle *b, const char *key)
        return BUNDLE_ERROR_NONE;
 }
 
-API const char *bundle_get_val(bundle *b, const char *key)
+const char *bundle_get_val(bundle *b, const char *key)
 {
        char *val = NULL;
        int ret = BUNDLE_ERROR_NONE;
@@ -286,7 +285,7 @@ static void _bundle_get_count_iter(const char *k, const int type,
        *count += 1;
 }
 
-API int bundle_get_count(bundle *b)
+int bundle_get_count(bundle *b)
 {
        int count = 0;
 
@@ -296,7 +295,7 @@ API int bundle_get_count(bundle *b)
        return count;
 }
 
-API void bundle_iterate(bundle *b, bundle_iterate_cb_t callback, void *data)
+void bundle_iterate(bundle *b, bundle_iterate_cb_t callback, void *data)
 {
        keyval_t *kv;
 
@@ -314,7 +313,7 @@ API void bundle_iterate(bundle *b, bundle_iterate_cb_t callback, void *data)
        set_last_result(BUNDLE_ERROR_NONE);
 }
 
-API void bundle_foreach(bundle *b, bundle_iterator_t iter, void *user_data)
+void bundle_foreach(bundle *b, bundle_iterator_t iter, void *user_data)
 {
        keyval_t *kv;
 
@@ -333,7 +332,7 @@ API void bundle_foreach(bundle *b, bundle_iterator_t iter, void *user_data)
 }
 
 /* keyval functions */
-API int bundle_keyval_get_type(bundle_keyval_t *kv)
+int bundle_keyval_get_type(bundle_keyval_t *kv)
 {
        if (kv == NULL) {
                set_last_result(BUNDLE_ERROR_INVALID_PARAMETER);
@@ -343,7 +342,7 @@ API int bundle_keyval_get_type(bundle_keyval_t *kv)
        return kv->type;
 }
 
-API int bundle_keyval_type_is_array(bundle_keyval_t *kv)
+int bundle_keyval_type_is_array(bundle_keyval_t *kv)
 {
        if (kv == NULL) {
                set_last_result(BUNDLE_ERROR_INVALID_PARAMETER);
@@ -353,7 +352,7 @@ API int bundle_keyval_type_is_array(bundle_keyval_t *kv)
        return keyval_type_is_array(kv->type);
 }
 
-API int bundle_keyval_type_is_measurable(bundle_keyval_t *kv)
+int bundle_keyval_type_is_measurable(bundle_keyval_t *kv)
 {
        if (kv == NULL) {
                set_last_result(BUNDLE_ERROR_INVALID_PARAMETER);
@@ -363,20 +362,19 @@ API int bundle_keyval_type_is_measurable(bundle_keyval_t *kv)
        return keyval_type_is_measurable(kv->type);
 }
 
-API int bundle_keyval_get_basic_val(bundle_keyval_t *kv, void **val,
-               size_t *size)
+int bundle_keyval_get_basic_val(bundle_keyval_t *kv, void **val, size_t *size)
 {
        return keyval_get_data(kv, NULL, val, size);
 }
 
-API int bundle_keyval_get_array_val(bundle_keyval_t *kv, void ***array_val,
+int bundle_keyval_get_array_val(bundle_keyval_t *kv, void ***array_val,
                unsigned int *array_len, size_t **array_item_size)
 {
        return keyval_array_get_data((keyval_array_t *)kv, NULL,
                        array_val, array_len, array_item_size);
 }
 
-API bundle_keyval_t *bundle_keyval_dup(const bundle_keyval_t *kv)
+bundle_keyval_t *bundle_keyval_dup(const bundle_keyval_t *kv)
 {
        bundle_keyval_t *ret_kv = NULL;
        void *byte = NULL;
@@ -410,7 +408,7 @@ API bundle_keyval_t *bundle_keyval_dup(const bundle_keyval_t *kv)
        return ret_kv;
 }
 
-API bundle *bundle_dup(bundle *b_from)
+bundle *bundle_dup(bundle *b_from)
 {
        bundle *b_to;
        keyval_t *kv_from;
@@ -462,7 +460,7 @@ err:
        return NULL;
 }
 
-API int bundle_encode(bundle *b, bundle_raw **r, int *len)
+int bundle_encode(bundle *b, bundle_raw **r, int *len)
 {
        keyval_t *kv;
        unsigned char *m;
@@ -519,7 +517,7 @@ API int bundle_encode(bundle *b, bundle_raw **r, int *len)
        return BUNDLE_ERROR_NONE;
 }
 
-API int bundle_free_encoded_rawdata(bundle_raw **r)
+int bundle_free_encoded_rawdata(bundle_raw **r)
 {
        if (!*r)
                return BUNDLE_ERROR_INVALID_PARAMETER; /* TC_FIX - double free sigabrt handling */
@@ -529,7 +527,7 @@ API int bundle_free_encoded_rawdata(bundle_raw **r)
        return BUNDLE_ERROR_NONE;
 }
 
-API bundle *bundle_decode(const bundle_raw *r, const int data_size)
+bundle *bundle_decode(const bundle_raw *r, const int data_size)
 {
        bundle *b;
        bundle_raw *p_r;
@@ -643,7 +641,7 @@ struct _argv_idx {
        int idx;
 };
 
-API int bundle_encode_raw(bundle *b, bundle_raw **r, int *len)
+int bundle_encode_raw(bundle *b, bundle_raw **r, int *len)
 {
        keyval_t *kv = NULL;
        unsigned char *m = NULL;
@@ -696,7 +694,7 @@ API int bundle_encode_raw(bundle *b, bundle_raw **r, int *len)
        return BUNDLE_ERROR_NONE;
 }
 
-API bundle *bundle_decode_raw(const bundle_raw *r, const int data_size)
+bundle *bundle_decode_raw(const bundle_raw *r, const int data_size)
 {
        bundle *b = NULL;
        bundle_raw *p_r = NULL;
@@ -812,7 +810,7 @@ void _iter_export_to_argv(const char *key, const int type, const keyval_t *kv,
        free(byte);
 }
 
-API int bundle_export_to_argv(bundle *b, char ***argv)
+int bundle_export_to_argv(bundle *b, char ***argv)
 {
        struct _argv_idx vi;
        int argc;
@@ -844,7 +842,7 @@ API int bundle_export_to_argv(bundle *b, char ***argv)
        return argc;
 }
 
-API int bundle_free_exported_argv(int argc, char ***argv)
+int bundle_free_exported_argv(int argc, char ***argv)
 {
        int i;
 
@@ -862,7 +860,7 @@ API int bundle_free_exported_argv(int argc, char ***argv)
        return BUNDLE_ERROR_NONE;
 }
 
-API bundle *bundle_import_from_argv(int argc, char **argv)
+bundle *bundle_import_from_argv(int argc, char **argv)
 {
        int idx;
        int type;
@@ -939,7 +937,7 @@ API bundle *bundle_import_from_argv(int argc, char **argv)
        return b;
 }
 
-API int bundle_get_type(bundle *b, const char *key)
+int bundle_get_type(bundle *b, const char *key)
 {
        keyval_t *kv = _bundle_find_kv(b, key);
 
@@ -1000,7 +998,7 @@ static int bundle_set_array_val(bundle *b, const char *key, const int type,
        return keyval_array_set_element(kva, idx, (void *)val, size);
 }
 
-API int bundle_add_str_array(bundle *b, const char *key, const char **str_array,
+int bundle_add_str_array(bundle *b, const char *key, const char **str_array,
                const int len)
 {
        return _bundle_add_kv(b, key, str_array, 0, BUNDLE_TYPE_STR_ARRAY, len);
@@ -1015,7 +1013,7 @@ int bundle_get_val_array(bundle *b, const char *key, char ***str_array,
 }
 /* LCOV_EXCL_STOP */
 
-API const char **bundle_get_str_array(bundle *b, const char *key, int *len)
+const char **bundle_get_str_array(bundle *b, const char *key, int *len)
 {
        int ret = BUNDLE_ERROR_NONE;
        const char **arr_val = NULL;
@@ -1027,7 +1025,7 @@ API const char **bundle_get_str_array(bundle *b, const char *key, int *len)
 }
 
 /* LCOV_EXCL_START */
-API int bundle_compare(bundle *b1, bundle *b2)
+int bundle_compare(bundle *b1, bundle *b2)
 {
        keyval_t *kv1;
        keyval_t *kv2;
@@ -1050,7 +1048,7 @@ API int bundle_compare(bundle *b1, bundle *b2)
 }
 /* LCOV_EXCL_STOP */
 
-API int bundle_set_str_array_element(bundle *b, const char *key,
+int bundle_set_str_array_element(bundle *b, const char *key,
                const unsigned int idx, const char *val)
 {
        if (!val)
@@ -1060,42 +1058,36 @@ API int bundle_set_str_array_element(bundle *b, const char *key,
                        idx, val, strlen(val) + 1);
 }
 
-API int bundle_add_byte(bundle *b, const char *key, const void *bytes,
+int bundle_add_byte(bundle *b, const char *key, const void *bytes,
                const size_t size)
 {
        return _bundle_add_kv(b, key, bytes, size, BUNDLE_TYPE_BYTE, 1);
 }
 
-API int bundle_get_byte(bundle *b, const char *key, void **bytes, size_t *size)
+int bundle_get_byte(bundle *b, const char *key, void **bytes, size_t *size)
 {
        return _bundle_get_val(b, key, BUNDLE_TYPE_BYTE, (void **)bytes,
                        size, NULL, NULL);
 }
 
-API int bundle_add_byte_array(bundle *b, const char *key,
-               const unsigned int len)
+int bundle_add_byte_array(bundle *b, const char *key, const unsigned int len)
 {
        return bundle_init_byte_array(b, key, len);
 }
 
-API int bundle_init_byte_array(bundle *b, const char *key,
-               const unsigned int len)
+int bundle_init_byte_array(bundle *b, const char *key, const unsigned int len)
 {
        return _bundle_add_kv(b, key, NULL, 0, BUNDLE_TYPE_BYTE_ARRAY, len);
 }
 
-API int bundle_get_byte_array(bundle *b, const char *key, void ***byte_array,
+int bundle_get_byte_array(bundle *b, const char *key, void ***byte_array,
                unsigned int *len, unsigned int **array_element_size)
 {
-       int ret;
-
-       ret = _bundle_get_val(b, key, BUNDLE_TYPE_BYTE_ARRAY,
-                       (void **)byte_array, NULL, len,
-                       (size_t **)array_element_size);
-       return ret;
+       return _bundle_get_val(b, key, BUNDLE_TYPE_BYTE_ARRAY,
+                       (void **)byte_array, NULL, len, (size_t **)array_element_size);
 }
 
-API int bundle_set_byte_array_element(bundle *b, const char *key,
+int bundle_set_byte_array_element(bundle *b, const char *key,
                const unsigned int idx, const void *bytes, const size_t size)
 {
        return bundle_set_array_val(b, key, BUNDLE_TYPE_BYTE_ARRAY,
index 38be1a4fcc2e31cb6a4780210cd58207722cdc07..8dad013d5aa2be60d8ad0e7673d3e15481747b57 100644 (file)
@@ -21,7 +21,6 @@
 
 #include "bundle.h"
 #include "bundle_internal.h"
-#include "bundle_private.h"
 
 static void __add_json_data_from_bundle(const char *key,
                const int type,
@@ -65,7 +64,7 @@ static void __add_json_data_from_bundle(const char *key,
        }
 }
 
-API int bundle_to_json(bundle *b, char **json)
+int bundle_to_json(bundle *b, char **json)
 {
        JsonObject *object;
        JsonNode *node;
@@ -162,7 +161,7 @@ static void __add_bundle_data_from_json(JsonObject *object,
        }
 }
 
-API int bundle_from_json(const char *json, bundle **b)
+int bundle_from_json(const char *json, bundle **b)
 {
        GError *error = NULL;
        JsonParser *parser;
diff --git a/src/bundle_private.h b/src/bundle_private.h
deleted file mode 100644 (file)
index 486d513..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __BUNDLE_PRIVATE_H__
-#define __BUNDLE_PRIVATE_H__
-
-#ifdef API
-#undef API
-#endif
-#define API __attribute__((visibility("default")))
-
-#ifdef likely
-#undef likely
-#endif
-#define likely(x) __builtin_expect(x, 1)
-
-#ifdef unlikely
-#undef unlikely
-#endif
-#define unlikely(x) __builtin_expect(x, 0)
-
-#endif /* __BUNDLE_PRIVATE_H__ */
index 843cd7b226d35660c2319949aab31b4261ac3b1b..6dddc35eba042c3175187d20d195e99d8ddeb83e 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 
-#include "bundle.h"
-#include "bundle_log.h"
-#include "bundle_private.h"
-#include "keyval.h"
 #include "keyval_array.h"
+#include "keyval.h"
 #include "keyval_type.h"
+#include "bundle.h"
+#include "bundle_log.h"
 
 static keyval_method_collection_t method = {
        (keyval_method_free_t) keyval_array_free,