forked from enlightenment/efl
ecore_data is deprecated, flag everything as such.
those functions with drop-in replacement are just calls to the eina version. SVN revision: 46543
This commit is contained in:
parent
9436429a09
commit
f838e162b3
|
@ -112,7 +112,7 @@ want_tslib="no"
|
|||
want_glib="no"
|
||||
|
||||
# core modules
|
||||
want_ecore_data="yes"
|
||||
want_ecore_data="no"
|
||||
want_ecore_txt="no"
|
||||
want_ecore_con="yes"
|
||||
want_ecore_ipc="no"
|
||||
|
@ -1414,7 +1414,7 @@ echo
|
|||
echo " Ecore........................: always"
|
||||
echo " Thread support.............: $have_pthread"
|
||||
echo " GLib support...............: $have_glib"
|
||||
echo " Ecore_Data...................: $have_ecore_data"
|
||||
echo " Ecore_Data...................: $have_ecore_data (deprecated)"
|
||||
echo " Ecore_Txt....................: $have_ecore_txt (deprecated)"
|
||||
echo " Ecore_Con....................: $have_ecore_con"
|
||||
if test "x$have_ecore_con" = "xyes" ; then
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <stddef.h>
|
||||
|
||||
#include <Eina.h>
|
||||
#warning "this file is deprecated. use Eina.h instead."
|
||||
|
||||
#ifdef EAPI
|
||||
# undef EAPI
|
||||
|
@ -71,7 +72,7 @@ extern "C" {
|
|||
typedef struct _ecore_list_node Ecore_List_Node;
|
||||
# define ECORE_LIST_NODE(node) ((Ecore_List_Node *)node)
|
||||
|
||||
typedef struct _ecore_strbuf Ecore_Strbuf;
|
||||
typedef Eina_Strbuf Ecore_Strbuf;
|
||||
# define ECORE_STRBUF(buf) ((Ecore_Strbuf *)buf)
|
||||
|
||||
struct _ecore_list_node {
|
||||
|
@ -91,75 +92,75 @@ extern "C" {
|
|||
list of current node */
|
||||
};
|
||||
|
||||
EAPI int ecore_direct_compare(const void *key1, const void *key2);
|
||||
EAPI int ecore_str_compare(const void *key1, const void *key2);
|
||||
EAPI int ecore_direct_compare(const void *key1, const void *key2) EINA_DEPRECATED;
|
||||
EAPI int ecore_str_compare(const void *key1, const void *key2) EINA_DEPRECATED;
|
||||
|
||||
EAPI unsigned int ecore_direct_hash(const void *key);
|
||||
EAPI unsigned int ecore_str_hash(const void *key);
|
||||
EAPI unsigned int ecore_direct_hash(const void *key) EINA_DEPRECATED;
|
||||
EAPI unsigned int ecore_str_hash(const void *key) EINA_DEPRECATED;
|
||||
|
||||
/* Creating and initializing new list structures */
|
||||
EAPI Ecore_List *ecore_list_new(void);
|
||||
EAPI int ecore_list_init(Ecore_List *list);
|
||||
EAPI Ecore_List *ecore_list_new(void) EINA_DEPRECATED;
|
||||
EAPI int ecore_list_init(Ecore_List *list) EINA_DEPRECATED;
|
||||
|
||||
/* Adding items to the list */
|
||||
EAPI int ecore_list_append(Ecore_List * list, void *_data);
|
||||
EAPI int ecore_list_prepend(Ecore_List * list, void *_data);
|
||||
EAPI int ecore_list_insert(Ecore_List * list, void *_data);
|
||||
EAPI int ecore_list_append_list(Ecore_List * list, Ecore_List * append);
|
||||
EAPI int ecore_list_prepend_list(Ecore_List * list, Ecore_List * prepend);
|
||||
EAPI int ecore_list_append(Ecore_List * list, void *_data) EINA_DEPRECATED;
|
||||
EAPI int ecore_list_prepend(Ecore_List * list, void *_data) EINA_DEPRECATED;
|
||||
EAPI int ecore_list_insert(Ecore_List * list, void *_data) EINA_DEPRECATED;
|
||||
EAPI int ecore_list_append_list(Ecore_List * list, Ecore_List * append) EINA_DEPRECATED;
|
||||
EAPI int ecore_list_prepend_list(Ecore_List * list, Ecore_List * prepend) EINA_DEPRECATED;
|
||||
|
||||
/* Removing items from the list */
|
||||
EAPI int ecore_list_remove_destroy(Ecore_List *list);
|
||||
EAPI void *ecore_list_remove(Ecore_List * list);
|
||||
EAPI void *ecore_list_first_remove(Ecore_List * list);
|
||||
EAPI void *ecore_list_last_remove(Ecore_List * list);
|
||||
EAPI int ecore_list_remove_destroy(Ecore_List *list) EINA_DEPRECATED;
|
||||
EAPI void *ecore_list_remove(Ecore_List * list) EINA_DEPRECATED;
|
||||
EAPI void *ecore_list_first_remove(Ecore_List * list) EINA_DEPRECATED;
|
||||
EAPI void *ecore_list_last_remove(Ecore_List * list) EINA_DEPRECATED;
|
||||
|
||||
/* Retrieve the current position in the list */
|
||||
EAPI void *ecore_list_current(Ecore_List * list);
|
||||
EAPI void *ecore_list_first(Ecore_List * list);
|
||||
EAPI void *ecore_list_last(Ecore_List * list);
|
||||
EAPI int ecore_list_index(Ecore_List * list);
|
||||
EAPI int ecore_list_count(Ecore_List * list);
|
||||
EAPI void *ecore_list_current(Ecore_List * list) EINA_DEPRECATED;
|
||||
EAPI void *ecore_list_first(Ecore_List * list) EINA_DEPRECATED;
|
||||
EAPI void *ecore_list_last(Ecore_List * list) EINA_DEPRECATED;
|
||||
EAPI int ecore_list_index(Ecore_List * list) EINA_DEPRECATED;
|
||||
EAPI int ecore_list_count(Ecore_List * list) EINA_DEPRECATED;
|
||||
|
||||
/* Traversing the list */
|
||||
EAPI int ecore_list_for_each(Ecore_List *list, Ecore_For_Each function,
|
||||
void *user_data);
|
||||
EAPI void *ecore_list_first_goto(Ecore_List * list);
|
||||
EAPI void *ecore_list_last_goto(Ecore_List * list);
|
||||
EAPI void *ecore_list_index_goto(Ecore_List * list, int index);
|
||||
EAPI void *ecore_list_goto(Ecore_List * list, const void *_data);
|
||||
void *user_data) EINA_DEPRECATED;
|
||||
EAPI void *ecore_list_first_goto(Ecore_List * list) EINA_DEPRECATED;
|
||||
EAPI void *ecore_list_last_goto(Ecore_List * list) EINA_DEPRECATED;
|
||||
EAPI void *ecore_list_index_goto(Ecore_List * list, int index) EINA_DEPRECATED;
|
||||
EAPI void *ecore_list_goto(Ecore_List * list, const void *_data) EINA_DEPRECATED;
|
||||
|
||||
/* Traversing the list and returning data */
|
||||
EAPI void *ecore_list_next(Ecore_List * list);
|
||||
EAPI void *ecore_list_next(Ecore_List * list) EINA_DEPRECATED;
|
||||
EAPI void *ecore_list_find(Ecore_List *list, Ecore_Compare_Cb function,
|
||||
const void *user_data);
|
||||
const void *user_data) EINA_DEPRECATED;
|
||||
|
||||
/* Sorting the list */
|
||||
EAPI int ecore_list_sort(Ecore_List *list, Ecore_Compare_Cb compare,
|
||||
char order);
|
||||
char order) EINA_DEPRECATED;
|
||||
EAPI int ecore_list_mergesort(Ecore_List *list, Ecore_Compare_Cb compare,
|
||||
char order);
|
||||
char order) EINA_DEPRECATED;
|
||||
EAPI int ecore_list_heapsort(Ecore_List *list, Ecore_Compare_Cb compare,
|
||||
char order);
|
||||
char order) EINA_DEPRECATED;
|
||||
EAPI void ecore_list_merge(Ecore_List *list, Ecore_List *l2,
|
||||
Ecore_Compare_Cb, char order);
|
||||
Ecore_Compare_Cb, char order) EINA_DEPRECATED;
|
||||
|
||||
/* Check to see if there is any data in the list */
|
||||
EAPI int ecore_list_empty_is(Ecore_List * list);
|
||||
EAPI int ecore_list_empty_is(Ecore_List * list) EINA_DEPRECATED;
|
||||
|
||||
/* Remove every node in the list without freeing the list itself */
|
||||
EAPI int ecore_list_clear(Ecore_List * list);
|
||||
EAPI int ecore_list_clear(Ecore_List * list) EINA_DEPRECATED;
|
||||
/* Free the list and it's contents */
|
||||
EAPI void ecore_list_destroy(Ecore_List *list);
|
||||
EAPI void ecore_list_destroy(Ecore_List *list) EINA_DEPRECATED;
|
||||
|
||||
/* Creating and initializing list nodes */
|
||||
EAPI Ecore_List_Node *ecore_list_node_new(void);
|
||||
EAPI int ecore_list_node_init(Ecore_List_Node *newNode);
|
||||
EAPI Ecore_List_Node *ecore_list_node_new(void) EINA_DEPRECATED;
|
||||
EAPI int ecore_list_node_init(Ecore_List_Node *newNode) EINA_DEPRECATED;
|
||||
|
||||
/* Destroying nodes */
|
||||
EAPI int ecore_list_node_destroy(Ecore_List_Node * _e_node, Ecore_Free_Cb free_func);
|
||||
EAPI int ecore_list_node_destroy(Ecore_List_Node * _e_node, Ecore_Free_Cb free_func) EINA_DEPRECATED;
|
||||
|
||||
EAPI int ecore_list_free_cb_set(Ecore_List * list, Ecore_Free_Cb free_func);
|
||||
EAPI int ecore_list_free_cb_set(Ecore_List * list, Ecore_Free_Cb free_func) EINA_DEPRECATED;
|
||||
|
||||
typedef Ecore_List Ecore_DList;
|
||||
# define ECORE_DLIST(dlist) ((Ecore_DList *)dlist)
|
||||
|
@ -173,66 +174,66 @@ extern "C" {
|
|||
};
|
||||
|
||||
/* Creating and initializing new list structures */
|
||||
EAPI Ecore_DList *ecore_dlist_new(void);
|
||||
EAPI int ecore_dlist_init(Ecore_DList *list);
|
||||
EAPI void ecore_dlist_destroy(Ecore_DList *list);
|
||||
EAPI Ecore_DList *ecore_dlist_new(void) EINA_DEPRECATED;
|
||||
EAPI int ecore_dlist_init(Ecore_DList *list) EINA_DEPRECATED;
|
||||
EAPI void ecore_dlist_destroy(Ecore_DList *list) EINA_DEPRECATED;
|
||||
|
||||
/* Adding items to the list */
|
||||
EAPI int ecore_dlist_append(Ecore_DList * _e_dlist, void *_data);
|
||||
EAPI int ecore_dlist_prepend(Ecore_DList * _e_dlist, void *_data);
|
||||
EAPI int ecore_dlist_insert(Ecore_DList * _e_dlist, void *_data);
|
||||
EAPI int ecore_dlist_append_list(Ecore_DList * _e_dlist, Ecore_DList * append);
|
||||
EAPI int ecore_dlist_prepend_list(Ecore_DList * _e_dlist, Ecore_DList * prepend);
|
||||
EAPI int ecore_dlist_append(Ecore_DList * _e_dlist, void *_data) EINA_DEPRECATED;
|
||||
EAPI int ecore_dlist_prepend(Ecore_DList * _e_dlist, void *_data) EINA_DEPRECATED;
|
||||
EAPI int ecore_dlist_insert(Ecore_DList * _e_dlist, void *_data) EINA_DEPRECATED;
|
||||
EAPI int ecore_dlist_append_list(Ecore_DList * _e_dlist, Ecore_DList * append) EINA_DEPRECATED;
|
||||
EAPI int ecore_dlist_prepend_list(Ecore_DList * _e_dlist, Ecore_DList * prepend) EINA_DEPRECATED;
|
||||
|
||||
/* Info about list's state */
|
||||
# define ecore_dlist_first(list) ecore_list_first(list)
|
||||
# define ecore_dlist_last(list) ecore_list_last(list)
|
||||
EAPI void *ecore_dlist_current(Ecore_DList *list);
|
||||
EAPI int ecore_dlist_index(Ecore_DList *list);
|
||||
EAPI void *ecore_dlist_current(Ecore_DList *list) EINA_DEPRECATED;
|
||||
EAPI int ecore_dlist_index(Ecore_DList *list) EINA_DEPRECATED;
|
||||
# define ecore_dlist_count(list) ecore_list_count(list)
|
||||
|
||||
/* Removing items from the list */
|
||||
EAPI void *ecore_dlist_remove(Ecore_DList * _e_dlist);
|
||||
EAPI void *ecore_dlist_first_remove(Ecore_DList * _e_dlist);
|
||||
EAPI int ecore_dlist_remove_destroy(Ecore_DList *list);
|
||||
EAPI void *ecore_dlist_last_remove(Ecore_DList * _e_dlist);
|
||||
EAPI void *ecore_dlist_remove(Ecore_DList * _e_dlist) EINA_DEPRECATED;
|
||||
EAPI void *ecore_dlist_first_remove(Ecore_DList * _e_dlist) EINA_DEPRECATED;
|
||||
EAPI int ecore_dlist_remove_destroy(Ecore_DList *list) EINA_DEPRECATED;
|
||||
EAPI void *ecore_dlist_last_remove(Ecore_DList * _e_dlist) EINA_DEPRECATED;
|
||||
|
||||
/* Traversing the list */
|
||||
# define ecore_dlist_for_each(list, function, user_data) \
|
||||
ecore_list_for_each(list, function, user_data)
|
||||
EAPI void *ecore_dlist_first_goto(Ecore_DList * _e_dlist);
|
||||
EAPI void *ecore_dlist_last_goto(Ecore_DList * _e_dlist);
|
||||
EAPI void *ecore_dlist_index_goto(Ecore_DList * _e_dlist, int index);
|
||||
EAPI void *ecore_dlist_goto(Ecore_DList * _e_dlist, void *_data);
|
||||
EAPI void *ecore_dlist_first_goto(Ecore_DList * _e_dlist) EINA_DEPRECATED;
|
||||
EAPI void *ecore_dlist_last_goto(Ecore_DList * _e_dlist) EINA_DEPRECATED;
|
||||
EAPI void *ecore_dlist_index_goto(Ecore_DList * _e_dlist, int index) EINA_DEPRECATED;
|
||||
EAPI void *ecore_dlist_goto(Ecore_DList * _e_dlist, void *_data) EINA_DEPRECATED;
|
||||
|
||||
/* Traversing the list and returning data */
|
||||
EAPI void *ecore_dlist_next(Ecore_DList * list);
|
||||
EAPI void *ecore_dlist_previous(Ecore_DList * list);
|
||||
EAPI void *ecore_dlist_next(Ecore_DList * list) EINA_DEPRECATED;
|
||||
EAPI void *ecore_dlist_previous(Ecore_DList * list) EINA_DEPRECATED;
|
||||
|
||||
/* Sorting the list */
|
||||
EAPI int ecore_dlist_sort(Ecore_DList *list, Ecore_Compare_Cb compare,
|
||||
char order);
|
||||
char order) EINA_DEPRECATED;
|
||||
EAPI int ecore_dlist_mergesort(Ecore_DList *list, Ecore_Compare_Cb compare,
|
||||
char order);
|
||||
char order) EINA_DEPRECATED;
|
||||
# define ecore_dlist_heapsort(list, compare, order) \
|
||||
ecore_list_heapsort(list, compare, order)
|
||||
EAPI void ecore_dlist_merge(Ecore_DList *list, Ecore_DList *l2,
|
||||
Ecore_Compare_Cb, char order);
|
||||
Ecore_Compare_Cb, char order) EINA_DEPRECATED;
|
||||
|
||||
/* Check to see if there is any data in the list */
|
||||
EAPI int ecore_dlist_empty_is(Ecore_DList * _e_dlist);
|
||||
EAPI int ecore_dlist_empty_is(Ecore_DList * _e_dlist) EINA_DEPRECATED;
|
||||
|
||||
/* Remove every node in the list without free'ing it */
|
||||
EAPI int ecore_dlist_clear(Ecore_DList * _e_dlist);
|
||||
EAPI int ecore_dlist_clear(Ecore_DList * _e_dlist) EINA_DEPRECATED;
|
||||
|
||||
/* Creating and initializing list nodes */
|
||||
EAPI int ecore_dlist_node_init(Ecore_DList_Node * node);
|
||||
EAPI Ecore_DList_Node *ecore_dlist_node_new(void);
|
||||
EAPI int ecore_dlist_node_init(Ecore_DList_Node * node) EINA_DEPRECATED;
|
||||
EAPI Ecore_DList_Node *ecore_dlist_node_new(void) EINA_DEPRECATED;
|
||||
|
||||
/* Destroying nodes */
|
||||
EAPI int ecore_dlist_node_destroy(Ecore_DList_Node * node, Ecore_Free_Cb free_func);
|
||||
EAPI int ecore_dlist_node_destroy(Ecore_DList_Node * node, Ecore_Free_Cb free_func) EINA_DEPRECATED;
|
||||
|
||||
EAPI int ecore_dlist_free_cb_set(Ecore_DList * dlist, Ecore_Free_Cb free_func);
|
||||
EAPI int ecore_dlist_free_cb_set(Ecore_DList * dlist, Ecore_Free_Cb free_func) EINA_DEPRECATED;
|
||||
|
||||
|
||||
|
||||
|
@ -272,27 +273,27 @@ extern "C" {
|
|||
};
|
||||
|
||||
/* Create and initialize a hash */
|
||||
EAPI Ecore_Hash *ecore_hash_new(Ecore_Hash_Cb hash_func, Ecore_Compare_Cb compare);
|
||||
EAPI int ecore_hash_init(Ecore_Hash *hash, Ecore_Hash_Cb hash_func, Ecore_Compare_Cb compare);
|
||||
EAPI Ecore_Hash *ecore_hash_new(Ecore_Hash_Cb hash_func, Ecore_Compare_Cb compare) EINA_DEPRECATED;
|
||||
EAPI int ecore_hash_init(Ecore_Hash *hash, Ecore_Hash_Cb hash_func, Ecore_Compare_Cb compare) EINA_DEPRECATED;
|
||||
|
||||
/* Functions related to freeing the data in the hash table */
|
||||
EAPI int ecore_hash_free_key_cb_set(Ecore_Hash *hash, Ecore_Free_Cb function);
|
||||
EAPI int ecore_hash_free_value_cb_set(Ecore_Hash *hash, Ecore_Free_Cb function);
|
||||
EAPI void ecore_hash_destroy(Ecore_Hash *hash);
|
||||
EAPI int ecore_hash_free_key_cb_set(Ecore_Hash *hash, Ecore_Free_Cb function) EINA_DEPRECATED;
|
||||
EAPI int ecore_hash_free_value_cb_set(Ecore_Hash *hash, Ecore_Free_Cb function) EINA_DEPRECATED;
|
||||
EAPI void ecore_hash_destroy(Ecore_Hash *hash) EINA_DEPRECATED;
|
||||
|
||||
EAPI int ecore_hash_count(Ecore_Hash *hash);
|
||||
EAPI int ecore_hash_count(Ecore_Hash *hash) EINA_DEPRECATED;
|
||||
EAPI int ecore_hash_for_each_node(Ecore_Hash *hash, Ecore_For_Each for_each_func,
|
||||
void *user_data);
|
||||
EAPI Ecore_List *ecore_hash_keys(Ecore_Hash *hash);
|
||||
void *user_data) EINA_DEPRECATED;
|
||||
EAPI Ecore_List *ecore_hash_keys(Ecore_Hash *hash) EINA_DEPRECATED;
|
||||
|
||||
/* Retrieve and store data into the hash */
|
||||
EAPI void *ecore_hash_get(Ecore_Hash *hash, const void *key);
|
||||
EAPI int ecore_hash_set(Ecore_Hash *hash, void *key, void *value);
|
||||
EAPI int ecore_hash_hash_set(Ecore_Hash *hash, Ecore_Hash *set);
|
||||
EAPI void *ecore_hash_remove(Ecore_Hash *hash, const void *key);
|
||||
EAPI void *ecore_hash_find(Ecore_Hash *hash, Ecore_Compare_Cb compare, const void *value);
|
||||
EAPI void ecore_hash_dump_graph(Ecore_Hash *hash);
|
||||
EAPI void ecore_hash_dump_stats(Ecore_Hash *hash);
|
||||
EAPI void *ecore_hash_get(Ecore_Hash *hash, const void *key) EINA_DEPRECATED;
|
||||
EAPI int ecore_hash_set(Ecore_Hash *hash, void *key, void *value) EINA_DEPRECATED;
|
||||
EAPI int ecore_hash_hash_set(Ecore_Hash *hash, Ecore_Hash *set) EINA_DEPRECATED;
|
||||
EAPI void *ecore_hash_remove(Ecore_Hash *hash, const void *key) EINA_DEPRECATED;
|
||||
EAPI void *ecore_hash_find(Ecore_Hash *hash, Ecore_Compare_Cb compare, const void *value) EINA_DEPRECATED;
|
||||
EAPI void ecore_hash_dump_graph(Ecore_Hash *hash) EINA_DEPRECATED;
|
||||
EAPI void ecore_hash_dump_stats(Ecore_Hash *hash) EINA_DEPRECATED;
|
||||
|
||||
|
||||
typedef struct _ecore_path_group Ecore_Path_Group;
|
||||
|
@ -306,32 +307,32 @@ extern "C" {
|
|||
/*
|
||||
* Create a new path group
|
||||
*/
|
||||
EAPI Ecore_Path_Group *ecore_path_group_new(void);
|
||||
EAPI Ecore_Path_Group *ecore_path_group_new(void) EINA_DEPRECATED;
|
||||
|
||||
/*
|
||||
* Destroy a previous path group
|
||||
*/
|
||||
EAPI void ecore_path_group_del(Ecore_Path_Group *group);
|
||||
EAPI void ecore_path_group_del(Ecore_Path_Group *group) EINA_DEPRECATED;
|
||||
|
||||
/*
|
||||
* Add a directory to be searched for files
|
||||
*/
|
||||
EAPI void ecore_path_group_add(Ecore_Path_Group *group, const char *path);
|
||||
EAPI void ecore_path_group_add(Ecore_Path_Group *group, const char *path) EINA_DEPRECATED;
|
||||
|
||||
/*
|
||||
* Remove a directory to be searched for files
|
||||
*/
|
||||
EAPI void ecore_path_group_remove(Ecore_Path_Group *group, const char *path);
|
||||
EAPI void ecore_path_group_remove(Ecore_Path_Group *group, const char *path) EINA_DEPRECATED;
|
||||
|
||||
/*
|
||||
* Find the absolute path if it exists in the group of paths
|
||||
*/
|
||||
EAPI char * ecore_path_group_find(Ecore_Path_Group *group, const char *name);
|
||||
EAPI char * ecore_path_group_find(Ecore_Path_Group *group, const char *name) EINA_DEPRECATED;
|
||||
|
||||
/*
|
||||
* Get a list of all the available files in a path set
|
||||
*/
|
||||
EAPI Eina_List * ecore_path_group_available_get(Ecore_Path_Group *group);
|
||||
EAPI Eina_List * ecore_path_group_available_get(Ecore_Path_Group *group) EINA_DEPRECATED;
|
||||
|
||||
|
||||
typedef struct _ecore_plugin Ecore_Plugin;
|
||||
|
@ -343,19 +344,19 @@ extern "C" {
|
|||
/*
|
||||
* Load the specified plugin
|
||||
*/
|
||||
EAPI Ecore_Plugin *ecore_plugin_load(Ecore_Path_Group *group, const char *plugin, const char *version);
|
||||
EAPI Ecore_Plugin *ecore_plugin_load(Ecore_Path_Group *group, const char *plugin, const char *version) EINA_DEPRECATED;
|
||||
|
||||
/*
|
||||
* Unload the specified plugin
|
||||
*/
|
||||
EAPI void ecore_plugin_unload(Ecore_Plugin * plugin);
|
||||
EAPI void ecore_plugin_unload(Ecore_Plugin * plugin) EINA_DEPRECATED;
|
||||
|
||||
/*
|
||||
* Lookup the specified symbol for the plugin
|
||||
*/
|
||||
EAPI void *ecore_plugin_symbol_get(Ecore_Plugin * plugin, const char *symbol_name);
|
||||
EAPI void *ecore_plugin_symbol_get(Ecore_Plugin * plugin, const char *symbol_name) EINA_DEPRECATED;
|
||||
|
||||
EAPI Eina_List *ecore_plugin_available_get(Ecore_Path_Group *group);
|
||||
EAPI Eina_List *ecore_plugin_available_get(Ecore_Path_Group *group) EINA_DEPRECATED;
|
||||
|
||||
|
||||
typedef struct _ecore_heap Ecore_Sheap;
|
||||
|
@ -375,19 +376,19 @@ extern "C" {
|
|||
Ecore_Free_Cb free_func;
|
||||
};
|
||||
|
||||
EAPI Ecore_Sheap *ecore_sheap_new(Ecore_Compare_Cb compare, int size);
|
||||
EAPI void ecore_sheap_destroy(Ecore_Sheap *heap);
|
||||
EAPI int ecore_sheap_init(Ecore_Sheap *heap, Ecore_Compare_Cb compare, int size);
|
||||
EAPI int ecore_sheap_free_cb_set(Ecore_Sheap *heap, Ecore_Free_Cb free_func);
|
||||
EAPI int ecore_sheap_insert(Ecore_Sheap *heap, void *data);
|
||||
EAPI void *ecore_sheap_extract(Ecore_Sheap *heap);
|
||||
EAPI void *ecore_sheap_extreme(Ecore_Sheap *heap);
|
||||
EAPI int ecore_sheap_change(Ecore_Sheap *heap, void *item, void *newval);
|
||||
EAPI int ecore_sheap_compare_set(Ecore_Sheap *heap, Ecore_Compare_Cb compare);
|
||||
EAPI void ecore_sheap_order_set(Ecore_Sheap *heap, char order);
|
||||
EAPI void ecore_sheap_sort(Ecore_Sheap *heap);
|
||||
EAPI Ecore_Sheap *ecore_sheap_new(Ecore_Compare_Cb compare, int size) EINA_DEPRECATED;
|
||||
EAPI void ecore_sheap_destroy(Ecore_Sheap *heap) EINA_DEPRECATED;
|
||||
EAPI int ecore_sheap_init(Ecore_Sheap *heap, Ecore_Compare_Cb compare, int size) EINA_DEPRECATED;
|
||||
EAPI int ecore_sheap_free_cb_set(Ecore_Sheap *heap, Ecore_Free_Cb free_func) EINA_DEPRECATED;
|
||||
EAPI int ecore_sheap_insert(Ecore_Sheap *heap, void *data) EINA_DEPRECATED;
|
||||
EAPI void *ecore_sheap_extract(Ecore_Sheap *heap) EINA_DEPRECATED;
|
||||
EAPI void *ecore_sheap_extreme(Ecore_Sheap *heap) EINA_DEPRECATED;
|
||||
EAPI int ecore_sheap_change(Ecore_Sheap *heap, void *item, void *newval) EINA_DEPRECATED;
|
||||
EAPI int ecore_sheap_compare_set(Ecore_Sheap *heap, Ecore_Compare_Cb compare) EINA_DEPRECATED;
|
||||
EAPI void ecore_sheap_order_set(Ecore_Sheap *heap, char order) EINA_DEPRECATED;
|
||||
EAPI void ecore_sheap_sort(Ecore_Sheap *heap) EINA_DEPRECATED;
|
||||
|
||||
EAPI void *ecore_sheap_item(Ecore_Sheap *heap, int i);
|
||||
EAPI void *ecore_sheap_item(Ecore_Sheap *heap, int i) EINA_DEPRECATED;
|
||||
|
||||
#define ecore_string_init eina_init
|
||||
#define ecore_string_shutdown eina_shutdown
|
||||
|
@ -432,82 +433,82 @@ extern "C" {
|
|||
|
||||
/* Some basic tree functions */
|
||||
/* Allocate and initialize a new tree */
|
||||
EAPI Ecore_Tree *ecore_tree_new(Ecore_Compare_Cb compare_func);
|
||||
EAPI Ecore_Tree *ecore_tree_new(Ecore_Compare_Cb compare_func) EINA_DEPRECATED;
|
||||
/* Initialize a new tree */
|
||||
EAPI int ecore_tree_init(Ecore_Tree * tree, Ecore_Compare_Cb compare_func);
|
||||
EAPI int ecore_tree_init(Ecore_Tree * tree, Ecore_Compare_Cb compare_func) EINA_DEPRECATED;
|
||||
|
||||
/* Free the tree */
|
||||
EAPI int ecore_tree_destroy(Ecore_Tree * tree);
|
||||
EAPI int ecore_tree_destroy(Ecore_Tree * tree) EINA_DEPRECATED;
|
||||
/* Check to see if the tree has any nodes in it */
|
||||
EAPI int ecore_tree_empty_is(Ecore_Tree * tree);
|
||||
EAPI int ecore_tree_empty_is(Ecore_Tree * tree) EINA_DEPRECATED;
|
||||
|
||||
/* Retrieve the value associated with key */
|
||||
EAPI void *ecore_tree_get(Ecore_Tree * tree, const void *key);
|
||||
EAPI Ecore_Tree_Node *ecore_tree_get_node(Ecore_Tree * tree, const void *key);
|
||||
EAPI void *ecore_tree_get(Ecore_Tree * tree, const void *key) EINA_DEPRECATED;
|
||||
EAPI Ecore_Tree_Node *ecore_tree_get_node(Ecore_Tree * tree, const void *key) EINA_DEPRECATED;
|
||||
/* Retrieve the value of node with key greater than or equal to key */
|
||||
EAPI void *ecore_tree_closest_larger_get(Ecore_Tree * tree, const void *key);
|
||||
EAPI void *ecore_tree_closest_larger_get(Ecore_Tree * tree, const void *key) EINA_DEPRECATED;
|
||||
/* Retrieve the value of node with key less than or equal to key */
|
||||
EAPI void *ecore_tree_closest_smaller_get(Ecore_Tree * tree, const void *key);
|
||||
EAPI void *ecore_tree_closest_smaller_get(Ecore_Tree * tree, const void *key) EINA_DEPRECATED;
|
||||
|
||||
/* Set the value associated with key to value */
|
||||
EAPI int ecore_tree_set(Ecore_Tree * tree, void *key, void *value);
|
||||
EAPI int ecore_tree_set(Ecore_Tree * tree, void *key, void *value) EINA_DEPRECATED;
|
||||
/* Remove the key from the tree */
|
||||
EAPI int ecore_tree_remove(Ecore_Tree * tree, const void *key);
|
||||
EAPI int ecore_tree_remove(Ecore_Tree * tree, const void *key) EINA_DEPRECATED;
|
||||
|
||||
/* Add a node to the tree */
|
||||
EAPI int ecore_tree_node_add(Ecore_Tree * tree, Ecore_Tree_Node * node);
|
||||
EAPI int ecore_tree_node_add(Ecore_Tree * tree, Ecore_Tree_Node * node) EINA_DEPRECATED;
|
||||
/* Remove a node from the tree */
|
||||
EAPI int ecore_tree_node_remove(Ecore_Tree * tree, Ecore_Tree_Node * node);
|
||||
EAPI int ecore_tree_node_remove(Ecore_Tree * tree, Ecore_Tree_Node * node) EINA_DEPRECATED;
|
||||
|
||||
/* For each node in the tree perform the for_each_func function */
|
||||
/* For this one pass in the node */
|
||||
EAPI int ecore_tree_for_each_node(Ecore_Tree * tree, Ecore_For_Each for_each_func,
|
||||
void *user_data);
|
||||
void *user_data) EINA_DEPRECATED;
|
||||
/* And here pass in the node's value */
|
||||
EAPI int ecore_tree_for_each_node_value(Ecore_Tree * tree,
|
||||
Ecore_For_Each for_each_func,
|
||||
void *user_data);
|
||||
void *user_data) EINA_DEPRECATED;
|
||||
|
||||
/* Some basic node functions */
|
||||
/* Initialize a node */
|
||||
EAPI int ecore_tree_node_init(Ecore_Tree_Node * new_node);
|
||||
EAPI int ecore_tree_node_init(Ecore_Tree_Node * new_node) EINA_DEPRECATED;
|
||||
/* Allocate and initialize a new node */
|
||||
EAPI Ecore_Tree_Node *ecore_tree_node_new(void);
|
||||
EAPI Ecore_Tree_Node *ecore_tree_node_new(void) EINA_DEPRECATED;
|
||||
/* Free the desired node */
|
||||
EAPI int ecore_tree_node_destroy(Ecore_Tree_Node * node,
|
||||
Ecore_Free_Cb free_value, Ecore_Free_Cb free_key);
|
||||
Ecore_Free_Cb free_value, Ecore_Free_Cb free_key) EINA_DEPRECATED;
|
||||
|
||||
/* Set the node's key to key */
|
||||
EAPI int ecore_tree_node_key_set(Ecore_Tree_Node * node, void *key);
|
||||
EAPI int ecore_tree_node_key_set(Ecore_Tree_Node * node, void *key) EINA_DEPRECATED;
|
||||
/* Retrieve the key in node */
|
||||
EAPI void *ecore_tree_node_key_get(Ecore_Tree_Node * node);
|
||||
EAPI void *ecore_tree_node_key_get(Ecore_Tree_Node * node) EINA_DEPRECATED;
|
||||
|
||||
/* Set the node's value to value */
|
||||
EAPI int ecore_tree_node_value_set(Ecore_Tree_Node * node, void *value);
|
||||
EAPI int ecore_tree_node_value_set(Ecore_Tree_Node * node, void *value) EINA_DEPRECATED;
|
||||
/* Retrieve the value in node */
|
||||
EAPI void *ecore_tree_node_value_get(Ecore_Tree_Node * node);
|
||||
EAPI void *ecore_tree_node_value_get(Ecore_Tree_Node * node) EINA_DEPRECATED;
|
||||
|
||||
/* Add a function to free the data stored in nodes */
|
||||
EAPI int ecore_tree_free_value_cb_set(Ecore_Tree * tree, Ecore_Free_Cb free_value);
|
||||
EAPI int ecore_tree_free_value_cb_set(Ecore_Tree * tree, Ecore_Free_Cb free_value) EINA_DEPRECATED;
|
||||
/* Add a function to free the keys stored in nodes */
|
||||
EAPI int ecore_tree_free_key_cb_set(Ecore_Tree * tree, Ecore_Free_Cb free_key);
|
||||
EAPI int ecore_tree_free_key_cb_set(Ecore_Tree * tree, Ecore_Free_Cb free_key) EINA_DEPRECATED;
|
||||
|
||||
|
||||
EAPI Ecore_Strbuf * ecore_strbuf_new(void);
|
||||
EAPI void ecore_strbuf_free(Ecore_Strbuf *buf);
|
||||
EAPI void ecore_strbuf_append(Ecore_Strbuf *buf, const char *str);
|
||||
EAPI void ecore_strbuf_append_char(Ecore_Strbuf *buf, char c);
|
||||
EAPI Ecore_Strbuf * ecore_strbuf_new(void) EINA_DEPRECATED;
|
||||
EAPI void ecore_strbuf_free(Ecore_Strbuf *buf) EINA_DEPRECATED;
|
||||
EAPI void ecore_strbuf_append(Ecore_Strbuf *buf, const char *str) EINA_DEPRECATED;
|
||||
EAPI void ecore_strbuf_append_char(Ecore_Strbuf *buf, char c) EINA_DEPRECATED;
|
||||
EAPI void ecore_strbuf_insert(Ecore_Strbuf *buf, const char *str,
|
||||
size_t pos);
|
||||
size_t pos) EINA_DEPRECATED;
|
||||
# define ecore_strbuf_prepend(buf, str) ecore_strbuf_insert(buf, str, 0)
|
||||
EAPI const char * ecore_strbuf_string_get(Ecore_Strbuf *buf);
|
||||
EAPI size_t ecore_strbuf_length_get(Ecore_Strbuf *buf);
|
||||
EAPI const char * ecore_strbuf_string_get(Ecore_Strbuf *buf) EINA_DEPRECATED;
|
||||
EAPI size_t ecore_strbuf_length_get(Ecore_Strbuf *buf) EINA_DEPRECATED;
|
||||
EAPI int ecore_strbuf_replace(Ecore_Strbuf *buf, const char *str,
|
||||
const char *with, unsigned int n);
|
||||
const char *with, unsigned int n) EINA_DEPRECATED;
|
||||
# define ecore_strbuf_replace_first(buf, str, with) \
|
||||
ecore_strbuf_replace(buf, str, with, 1)
|
||||
EAPI int ecore_strbuf_replace_all(Ecore_Strbuf *buf, const char *str,
|
||||
const char *with);
|
||||
const char *with) EINA_DEPRECATED;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
#ifndef _ECORE_STR_H
|
||||
# define _ECORE_STR_H
|
||||
|
||||
#include <Eina.h>
|
||||
#warning "this file is deprecated. use Eina.h instead."
|
||||
|
||||
#ifdef EAPI
|
||||
# undef EAPI
|
||||
#endif
|
||||
|
@ -34,6 +37,8 @@
|
|||
/**
|
||||
* @file Ecore_Str.h
|
||||
* @brief Contains useful C string functions.
|
||||
*
|
||||
* @deprecated use Eina.h instead
|
||||
*/
|
||||
|
||||
# ifdef __cplusplus
|
||||
|
@ -49,20 +54,21 @@ extern "C" {
|
|||
|
||||
|
||||
/* strlcpy implementation for libc's lacking it */
|
||||
EAPI size_t ecore_strlcpy(char *dst, const char *src, size_t siz);
|
||||
EAPI size_t ecore_strlcat(char *dst, const char *src, size_t siz);
|
||||
EAPI size_t ecore_strlcpy(char *dst, const char *src, size_t siz) EINA_DEPRECATED;
|
||||
EAPI size_t ecore_strlcat(char *dst, const char *src, size_t siz) EINA_DEPRECATED;
|
||||
|
||||
EAPI int ecore_str_has_prefix(const char *str, const char *prefix);
|
||||
EAPI int ecore_str_has_prefix(const char *str, const char *prefix) EINA_DEPRECATED;
|
||||
|
||||
EAPI int ecore_str_has_suffix(const char *str, const char *suffix);
|
||||
EAPI int ecore_str_has_extension(const char *str, const char *ext);
|
||||
EAPI int ecore_str_has_suffix(const char *str, const char *suffix) EINA_DEPRECATED;
|
||||
EAPI int ecore_str_has_extension(const char *str, const char *ext) EINA_DEPRECATED;
|
||||
|
||||
EAPI char **ecore_str_split(const char *string, const char *delimiter,
|
||||
int max_tokens);
|
||||
EAPI char **ecore_str_split(const char *string, const char *delimiter, int max_tokens) EINA_DEPRECATED;
|
||||
|
||||
EAPI size_t ecore_str_join_len(char *dst, size_t size, char sep, const char *a, size_t a_len, const char *b, size_t b_len);
|
||||
EAPI size_t ecore_str_join_len(char *dst, size_t size, char sep, const char *a, size_t a_len, const char *b, size_t b_len) EINA_DEPRECATED;
|
||||
|
||||
|
||||
static inline size_t ecore_str_join(char *dst, size_t size, char sep, const char *a, const char *b) EINA_DEPRECATED;
|
||||
|
||||
/**
|
||||
* Join two strings and store the result in @a dst buffer.
|
||||
*
|
||||
|
|
|
@ -25,17 +25,8 @@
|
|||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "Ecore.h"
|
||||
#include "ecore_private.h"
|
||||
#include "Ecore_Str.h"
|
||||
|
||||
static int ecore_str_has_suffix_helper(const char *str, const char *suffix,
|
||||
int (*cmp)(const char *, const char *));
|
||||
/**
|
||||
* @param dst the destination
|
||||
* @param src the source
|
||||
|
@ -46,38 +37,13 @@ static int ecore_str_has_suffix_helper(const char *str, const char *suffix,
|
|||
* Copy src to string dst of size siz. At most siz-1 characters
|
||||
* will be copied. Always NUL terminates (unless siz == 0).
|
||||
* Returns strlen(src); if retval >= siz, truncation occurred.
|
||||
*
|
||||
* @deprecated use eina_strlcpy() instead.
|
||||
*/
|
||||
size_t
|
||||
ecore_strlcpy(char *dst, const char *src, size_t siz)
|
||||
{
|
||||
#ifdef HAVE_STRLCPY
|
||||
return strlcpy(dst, src, siz);
|
||||
#else
|
||||
char *d = dst;
|
||||
const char *s = src;
|
||||
size_t n = siz;
|
||||
|
||||
/* Copy as many bytes as will fit */
|
||||
if (n != 0)
|
||||
{
|
||||
while (--n != 0)
|
||||
{
|
||||
if ((*d++ = *s++) == '\0')
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Not enough room in dst, add NUL and traverse rest of src */
|
||||
if (n == 0)
|
||||
{
|
||||
if (siz != 0)
|
||||
*d = '\0'; /* NUL-terminate dst */
|
||||
while (*s++)
|
||||
;
|
||||
}
|
||||
|
||||
return(s - src - 1); /* count does not include NUL */
|
||||
#endif
|
||||
return eina_strlcpy(dst, src, siz);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -92,33 +58,13 @@ ecore_strlcpy(char *dst, const char *src, size_t siz)
|
|||
* will be copied. Always NUL terminates (unless siz <= strlen(dst)).
|
||||
* Returns strlen(src) + MIN(siz, strlen(initial dst)).
|
||||
* If retval >= siz, truncation occurred.
|
||||
*
|
||||
* @deprecated use eina_strlcat() instead.
|
||||
*/
|
||||
size_t
|
||||
ecore_strlcat(char *dst, const char *src, size_t siz)
|
||||
{
|
||||
char *d = dst;
|
||||
const char *s = src;
|
||||
size_t n = siz;
|
||||
size_t dlen;
|
||||
|
||||
/* Find the end of dst and adjust bytes left but don't go past end */
|
||||
while (n-- != 0 && *d != '\0')
|
||||
d++;
|
||||
dlen = d - dst;
|
||||
n = siz - dlen;
|
||||
|
||||
if (n == 0)
|
||||
return(dlen + strlen(s));
|
||||
while (*s != '\0') {
|
||||
if (n != 1) {
|
||||
*d++ = *s;
|
||||
n--;
|
||||
}
|
||||
s++;
|
||||
}
|
||||
*d = '\0';
|
||||
|
||||
return(dlen + (s - src)); /* count does not include NUL */
|
||||
return eina_strlcat(dst, src, siz);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -126,22 +72,13 @@ ecore_strlcat(char *dst, const char *src, size_t siz)
|
|||
* @param prefix the prefix to check for
|
||||
* @return true if str has the given prefix
|
||||
* @brief checks if the string has the given prefix
|
||||
*
|
||||
* @deprecated use eina_str_has_prefix() instead.
|
||||
*/
|
||||
int
|
||||
ecore_str_has_prefix(const char *str, const char *prefix)
|
||||
{
|
||||
size_t str_len;
|
||||
size_t prefix_len;
|
||||
|
||||
CHECK_PARAM_POINTER_RETURN("str", str, 0);
|
||||
CHECK_PARAM_POINTER_RETURN("prefix", prefix, 0);
|
||||
|
||||
str_len = strlen(str);
|
||||
prefix_len = strlen(prefix);
|
||||
if (prefix_len > str_len)
|
||||
return 0;
|
||||
|
||||
return (strncmp(str, prefix, prefix_len) == 0);
|
||||
return eina_str_has_prefix(str, prefix);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -149,14 +86,13 @@ ecore_str_has_prefix(const char *str, const char *prefix)
|
|||
* @param suffix the suffix to check for
|
||||
* @return true if str has the given suffix
|
||||
* @brief checks if the string has the given suffix
|
||||
*
|
||||
* @deprecated use eina_str_has_suffix() instead.
|
||||
*/
|
||||
int
|
||||
ecore_str_has_suffix(const char *str, const char *suffix)
|
||||
{
|
||||
CHECK_PARAM_POINTER_RETURN("str", str, 0);
|
||||
CHECK_PARAM_POINTER_RETURN("suffix", suffix, 0);
|
||||
|
||||
return ecore_str_has_suffix_helper(str, suffix, strcmp);
|
||||
return eina_str_has_suffix(str, suffix);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -167,33 +103,13 @@ ecore_str_has_suffix(const char *str, const char *suffix)
|
|||
* @param ext the extension to check for
|
||||
* @return true if str has the given extension
|
||||
* @brief checks if the string has the given extension
|
||||
*
|
||||
* @deprecated use eina_str_has_extension() instead.
|
||||
*/
|
||||
int
|
||||
ecore_str_has_extension(const char *str, const char *ext)
|
||||
{
|
||||
CHECK_PARAM_POINTER_RETURN("str", str, 0);
|
||||
CHECK_PARAM_POINTER_RETURN("ext", ext, 0);
|
||||
|
||||
return ecore_str_has_suffix_helper(str, ext, strcasecmp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Internal helper function used by ecore_str_has_suffix() and
|
||||
* ecore_str_has_extension()
|
||||
*/
|
||||
static int
|
||||
ecore_str_has_suffix_helper(const char *str, const char *suffix,
|
||||
int (*cmp)(const char *, const char *))
|
||||
{
|
||||
size_t str_len;
|
||||
size_t suffix_len;
|
||||
|
||||
str_len = strlen(str);
|
||||
suffix_len = strlen(suffix);
|
||||
if (suffix_len > str_len)
|
||||
return 0;
|
||||
|
||||
return cmp(str + str_len - suffix_len, suffix) == 0;
|
||||
return eina_str_has_extension(str, ext);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -210,37 +126,13 @@ ecore_str_has_suffix_helper(const char *str, const char *suffix,
|
|||
* @return A newly-allocated NULL-terminated array of strings.
|
||||
* To free it: free the first element of the array
|
||||
* and the array itself.
|
||||
*
|
||||
* @deprecated eina_str_split()
|
||||
*/
|
||||
char **
|
||||
ecore_str_split(const char *str, const char *delim, int max_tokens)
|
||||
{
|
||||
char *s, *sep, **str_array;
|
||||
size_t len, dlen;
|
||||
int i;
|
||||
|
||||
CHECK_PARAM_POINTER_RETURN("str", str, NULL);
|
||||
CHECK_PARAM_POINTER_RETURN("delim", delim, NULL);
|
||||
|
||||
if (*delim == '\0')
|
||||
return NULL;
|
||||
|
||||
max_tokens = ((max_tokens <= 0) ? (INT_MAX) : (max_tokens - 1));
|
||||
len = strlen(str);
|
||||
dlen = strlen(delim);
|
||||
s = strdup(str);
|
||||
str_array = malloc(sizeof(char *) * (len + 1));
|
||||
for (i = 0; (i < max_tokens) && (sep = strstr(s, delim)); i++)
|
||||
{
|
||||
str_array[i] = s;
|
||||
s = sep + dlen;
|
||||
*sep = 0;
|
||||
}
|
||||
|
||||
str_array[i++] = s;
|
||||
str_array = realloc(str_array, sizeof(char *) * (i + 1));
|
||||
str_array[i] = NULL;
|
||||
|
||||
return str_array;
|
||||
return eina_str_split(str, delim, max_tokens);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -262,42 +154,11 @@ ecore_str_split(const char *str, const char *delim, int max_tokens)
|
|||
* truncated.
|
||||
*
|
||||
* @see ecore_str_join() and ecore_str_join_static()
|
||||
*
|
||||
* @deprecated use eina_str_join_len() instead.
|
||||
*/
|
||||
size_t
|
||||
ecore_str_join_len(char *dst, size_t size, char sep, const char *a, size_t a_len, const char *b, size_t b_len)
|
||||
{
|
||||
size_t ret = a_len + b_len + 1;
|
||||
size_t off;
|
||||
|
||||
if (size < 1) return ret;
|
||||
|
||||
if (size <= a_len)
|
||||
{
|
||||
memcpy(dst, a, size - 1);
|
||||
dst[size - 1] = '\0';
|
||||
return ret;
|
||||
}
|
||||
|
||||
memcpy(dst, a, a_len);
|
||||
off = a_len;
|
||||
|
||||
if (size <= off + 1)
|
||||
{
|
||||
dst[size - 1] = '\0';
|
||||
return ret;
|
||||
}
|
||||
|
||||
dst[off] = sep;
|
||||
off++;
|
||||
|
||||
if (size <= off + b_len + 1)
|
||||
{
|
||||
memcpy(dst + off, b, size - off - 1);
|
||||
dst[size - 1] = '\0';
|
||||
return ret;
|
||||
}
|
||||
|
||||
memcpy(dst + off, b, b_len);
|
||||
dst[off + b_len] = '\0';
|
||||
return ret;
|
||||
return eina_str_join_len(dst, size, sep, a, a_len, b, b_len);
|
||||
}
|
||||
|
|
|
@ -6,90 +6,42 @@
|
|||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "Ecore.h"
|
||||
#include "ecore_private.h"
|
||||
#include "Ecore_Data.h"
|
||||
#include "Ecore_Str.h"
|
||||
|
||||
#define ECORE_STRBUF_INIT_SIZE 32
|
||||
#define ECORE_STRBUF_INIT_STEP 32
|
||||
#define ECORE_STRBUF_MAX_STEP 4096
|
||||
|
||||
struct _ecore_strbuf
|
||||
{
|
||||
char *buf;
|
||||
size_t len;
|
||||
size_t size;
|
||||
size_t step;
|
||||
};
|
||||
|
||||
static int _ecore_strbuf_resize(Ecore_Strbuf *buf, size_t size);
|
||||
|
||||
/**
|
||||
* Create a new string buffer
|
||||
*
|
||||
* @deprecated use eina_strbuf_new() instead.
|
||||
*/
|
||||
EAPI Ecore_Strbuf *
|
||||
ecore_strbuf_new(void)
|
||||
{
|
||||
Ecore_Strbuf *buf;
|
||||
|
||||
buf = malloc(sizeof(Ecore_Strbuf));
|
||||
if (!buf) return NULL;
|
||||
|
||||
buf->len = 0;
|
||||
buf->size = ECORE_STRBUF_INIT_SIZE;
|
||||
buf->step = ECORE_STRBUF_INIT_STEP;
|
||||
|
||||
buf->buf = malloc(buf->size);
|
||||
buf->buf[0] = '\0';
|
||||
|
||||
return buf;
|
||||
return eina_strbuf_new();
|
||||
}
|
||||
|
||||
/**
|
||||
* Free a string buffer
|
||||
* @param buf the buffer to free
|
||||
*
|
||||
* @deprecated use eina_strbuf_free() instead.
|
||||
*/
|
||||
EAPI void
|
||||
ecore_strbuf_free(Ecore_Strbuf *buf)
|
||||
{
|
||||
CHECK_PARAM_POINTER("buf", buf);
|
||||
free(buf->buf);
|
||||
free(buf);
|
||||
eina_strbuf_free(buf);
|
||||
}
|
||||
|
||||
/**
|
||||
* Append a string to a buffer, reallocating as necessary.
|
||||
* @param buf the Ecore_Strbuf to append to
|
||||
* @param str the string to append
|
||||
*
|
||||
* @deprecated use eina_strbuf_append() instead.
|
||||
*/
|
||||
EAPI void
|
||||
ecore_strbuf_append(Ecore_Strbuf *buf, const char *str)
|
||||
{
|
||||
size_t l;
|
||||
size_t off = 0;
|
||||
|
||||
CHECK_PARAM_POINTER("buf", buf);
|
||||
CHECK_PARAM_POINTER("str", str);
|
||||
|
||||
l = ecore_strlcpy(buf->buf + buf->len, str, buf->size - buf->len);
|
||||
|
||||
while (l > buf->size - buf->len)
|
||||
{
|
||||
/* we successfully appended this much */
|
||||
off += buf->size - buf->len - 1;
|
||||
buf->len = buf->size - 1;
|
||||
buf->size += buf->step;
|
||||
if (buf->step < ECORE_STRBUF_MAX_STEP)
|
||||
buf->step *= 2;
|
||||
buf->buf = realloc(buf->buf, buf->size);
|
||||
*(buf->buf + buf->len) = '\0';
|
||||
|
||||
l = ecore_strlcpy(buf->buf + buf->len, str + off, buf->size - buf->len);
|
||||
}
|
||||
buf->len += l;
|
||||
eina_strbuf_append(buf, str);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -97,54 +49,26 @@ ecore_strbuf_append(Ecore_Strbuf *buf, const char *str)
|
|||
* @param buf the Ecore_Strbuf to insert
|
||||
* @param str the string to insert
|
||||
* @param pos the position to insert the string
|
||||
*
|
||||
* @deprecated use eina_strbuf_insert() instead.
|
||||
*/
|
||||
EAPI void
|
||||
ecore_strbuf_insert(Ecore_Strbuf *buf, const char *str, size_t pos)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
CHECK_PARAM_POINTER("buf", buf);
|
||||
CHECK_PARAM_POINTER("str", str);
|
||||
|
||||
if (pos >= buf->len)
|
||||
{
|
||||
ecore_strbuf_append(buf, str);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* resize the buffer if necessary
|
||||
*/
|
||||
len = strlen(str);
|
||||
if (!_ecore_strbuf_resize(buf, buf->len + len))
|
||||
return;
|
||||
/* move the existing text */
|
||||
memmove(buf->buf + len + pos, buf->buf + pos, buf->len - pos);
|
||||
/* and now insert the given string */
|
||||
memcpy(buf->buf + pos, str, len);
|
||||
buf->len += len;
|
||||
buf->buf[buf->len] = 0;
|
||||
eina_strbuf_insert(buf, str, pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Append a character to a string buffer, reallocating as necessary.
|
||||
* @param buf the Ecore_Strbuf to append to
|
||||
* @param c the char to append
|
||||
*
|
||||
* @deprecated use eina_strbuf_append_char() instead.
|
||||
*/
|
||||
EAPI void
|
||||
ecore_strbuf_append_char(Ecore_Strbuf *buf, char c)
|
||||
{
|
||||
CHECK_PARAM_POINTER("buf", buf);
|
||||
if (buf->len >= buf->size - 1)
|
||||
{
|
||||
buf->size += buf->step;
|
||||
if (buf->step < ECORE_STRBUF_MAX_STEP)
|
||||
buf->step *= 2;
|
||||
buf->buf = realloc(buf->buf, buf->size);
|
||||
}
|
||||
|
||||
buf->buf[(buf->len)++] = c;
|
||||
buf->buf[buf->len] = '\0';
|
||||
eina_strbuf_append_char(buf, c);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -153,23 +77,25 @@ ecore_strbuf_append_char(Ecore_Strbuf *buf, char c)
|
|||
*
|
||||
* This pointer must not be modified, and will no longer be valid if
|
||||
* the Ecore_Strbuf is modified.
|
||||
*
|
||||
* @deprecated use eina_strbuf_string_get() instead.
|
||||
*/
|
||||
EAPI const char *
|
||||
ecore_strbuf_string_get(Ecore_Strbuf *buf)
|
||||
{
|
||||
CHECK_PARAM_POINTER_RETURN("buf", buf, NULL);
|
||||
return buf->buf;
|
||||
return eina_strbuf_string_get(buf);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the length of the string buffer content
|
||||
* @param buf the buffer
|
||||
*
|
||||
* @deprecated use eina_strbuf_length_get() instead.
|
||||
*/
|
||||
EAPI size_t
|
||||
ecore_strbuf_length_get(Ecore_Strbuf *buf)
|
||||
{
|
||||
CHECK_PARAM_POINTER_RETURN("buf", buf, 0);
|
||||
return buf->len;
|
||||
return eina_strbuf_length_get(buf);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -180,49 +106,14 @@ ecore_strbuf_length_get(Ecore_Strbuf *buf)
|
|||
* @param n the number of the fitting string
|
||||
*
|
||||
* @return true on success
|
||||
*
|
||||
* @deprecated use eina_strbuf_replace() instead.
|
||||
*/
|
||||
EAPI int
|
||||
ecore_strbuf_replace(Ecore_Strbuf *buf, const char *str, const char *with,
|
||||
unsigned int n)
|
||||
{
|
||||
size_t len1, len2;
|
||||
char *spos;
|
||||
size_t pos;
|
||||
|
||||
CHECK_PARAM_POINTER_RETURN("buf", buf, 0);
|
||||
CHECK_PARAM_POINTER_RETURN("str", str, 0);
|
||||
CHECK_PARAM_POINTER_RETURN("with", with, 0);
|
||||
|
||||
if (n == 0)
|
||||
return 0;
|
||||
|
||||
spos = buf->buf;
|
||||
while (n--)
|
||||
{
|
||||
spos = strstr(spos, str);
|
||||
if (!spos || *spos == '\0')
|
||||
return 0;
|
||||
if (n) spos++;
|
||||
}
|
||||
|
||||
pos = spos - buf->buf;
|
||||
len1 = strlen(str);
|
||||
len2 = strlen(with);
|
||||
if (len1 != len2)
|
||||
{
|
||||
/* resize the buffer if necessary */
|
||||
if (!_ecore_strbuf_resize(buf, buf->len - len1 + len2))
|
||||
return 0;
|
||||
/* move the existing text */
|
||||
memmove(buf->buf + pos + len2, buf->buf + pos + len1,
|
||||
buf->len - pos - len1);
|
||||
}
|
||||
/* and now insert the given string */
|
||||
memcpy(buf->buf + pos, with, len2);
|
||||
buf->len += len2 - len1;
|
||||
buf->buf[buf->len] = 0;
|
||||
|
||||
return 1;
|
||||
return eina_strbuf_replace(buf, str, with, n);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -232,138 +123,11 @@ ecore_strbuf_replace(Ecore_Strbuf *buf, const char *str, const char *with,
|
|||
* @param with the replaceing string
|
||||
*
|
||||
* @return how often the string was replaced
|
||||
*
|
||||
* @deprecated use eina_strbuf_replace_all() instead.
|
||||
*/
|
||||
EAPI int
|
||||
ecore_strbuf_replace_all(Ecore_Strbuf *buf, const char *str, const char *with)
|
||||
{
|
||||
size_t len1, len2, len;
|
||||
char *tmp_buf = NULL;
|
||||
char *spos;
|
||||
size_t pos, start;
|
||||
size_t pos_tmp, start_tmp;
|
||||
int n = 0;
|
||||
|
||||
CHECK_PARAM_POINTER_RETURN("buf", buf, 0);
|
||||
CHECK_PARAM_POINTER_RETURN("str", str, 0);
|
||||
CHECK_PARAM_POINTER_RETURN("with", with, 0);
|
||||
|
||||
spos = strstr(buf->buf, str);
|
||||
if (!spos || *spos == '\0')
|
||||
return 0;
|
||||
|
||||
len1 = strlen(str);
|
||||
len2 = strlen(with);
|
||||
|
||||
/* if the size of the two string is equal, it is fairly easy to replace them
|
||||
* we don't need to resize the buffer or doing other calculations */
|
||||
if (len1 == len2)
|
||||
{
|
||||
while (spos)
|
||||
{
|
||||
memcpy(spos, with, len2);
|
||||
spos = strstr(spos + len2, str);
|
||||
n++;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
pos = pos_tmp = spos - buf->buf;
|
||||
tmp_buf = buf->buf;
|
||||
buf->buf = malloc(buf->size);
|
||||
if (!buf->buf)
|
||||
{
|
||||
buf->buf = tmp_buf;
|
||||
return 0;
|
||||
}
|
||||
start = start_tmp = 0;
|
||||
len = buf->len;
|
||||
|
||||
while (spos)
|
||||
{
|
||||
n++;
|
||||
len = (len + len2) - len1;
|
||||
/* resize the buffer if necessary */
|
||||
if (!_ecore_strbuf_resize(buf, len))
|
||||
{
|
||||
/* we have to stop replacing here, because we haven't enough
|
||||
* memory to go on */
|
||||
len = (len + len1) - len2;
|
||||
break;
|
||||
}
|
||||
|
||||
/* copy the untouched text */
|
||||
memcpy(buf->buf + start, tmp_buf + start_tmp, pos - start);
|
||||
/* copy the new string */
|
||||
memcpy(buf->buf + pos, with, len2);
|
||||
|
||||
/* calculate the next positions */
|
||||
start_tmp = pos_tmp + len1;
|
||||
start = pos + len2;
|
||||
spos = strstr(tmp_buf + start_tmp, str);
|
||||
/* this calculations don't make sense if spos == NULL, but the
|
||||
* calculated values won't be used, because the loop will stop
|
||||
* then */
|
||||
pos_tmp = spos - tmp_buf;
|
||||
pos = start + pos_tmp - start_tmp;
|
||||
}
|
||||
/* and now copy the rest of the text */
|
||||
memcpy(buf->buf + start, tmp_buf + start_tmp, len - start);
|
||||
buf->len = len;
|
||||
buf->buf[buf->len] = 0;
|
||||
|
||||
free(tmp_buf);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* resize the buffer
|
||||
* @param buf the buffer to resize
|
||||
* @param size the minimum size of the buffer
|
||||
*/
|
||||
static int
|
||||
_ecore_strbuf_resize(Ecore_Strbuf *buf, size_t size)
|
||||
{
|
||||
char *buffer;
|
||||
size_t new_size;
|
||||
size_t new_step;
|
||||
|
||||
new_size = buf->size;
|
||||
new_step = buf->step;
|
||||
|
||||
/*
|
||||
* first we have to determine the new buffer size
|
||||
*/
|
||||
if (size == buf->size)
|
||||
/* nothing to do */
|
||||
return 1;
|
||||
else if (size > buf->size)
|
||||
{
|
||||
/* enlarge the buffer */
|
||||
while (size > new_size)
|
||||
{
|
||||
new_size += new_step;
|
||||
if (new_step < ECORE_STRBUF_MAX_STEP)
|
||||
new_step *= 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* shrink the buffer */
|
||||
/*
|
||||
* to be done
|
||||
*/
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* reallocate the buffer to the new size */
|
||||
buffer = realloc(buf->buf, new_size);
|
||||
if (!buffer)
|
||||
return 0;
|
||||
|
||||
buf->buf = buffer;
|
||||
buf->size = new_size;
|
||||
buf->step = new_step;
|
||||
return 1;
|
||||
return eina_strbuf_replace_all(buf, str, with);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue