diff options
Diffstat (limited to 'src/bin')
-rw-r--r-- | src/bin/evas/evas_cserve2_cache.c | 1 | ||||
-rw-r--r-- | src/bin/evas/evas_cserve2_index.c | 27 |
2 files changed, 17 insertions, 11 deletions
diff --git a/src/bin/evas/evas_cserve2_cache.c b/src/bin/evas/evas_cserve2_cache.c index 5bbe014fae..1a025a8332 100644 --- a/src/bin/evas/evas_cserve2_cache.c +++ b/src/bin/evas/evas_cserve2_cache.c | |||
@@ -1588,7 +1588,6 @@ _font_load_request_response(Font_Entry *fe, Slave_Msg_Font_Loaded *msg, int *siz | |||
1588 | 1588 | ||
1589 | if (fe->base.request) fe->base.request = NULL; | 1589 | if (fe->base.request) fe->base.request = NULL; |
1590 | 1590 | ||
1591 | /* could be a function, but it's too basic and only used here */ | ||
1592 | resp = calloc(1, sizeof(*resp)); | 1591 | resp = calloc(1, sizeof(*resp)); |
1593 | resp->base.type = CSERVE2_FONT_LOADED; | 1592 | resp->base.type = CSERVE2_FONT_LOADED; |
1594 | *size = sizeof(*resp); | 1593 | *size = sizeof(*resp); |
diff --git a/src/bin/evas/evas_cserve2_index.c b/src/bin/evas/evas_cserve2_index.c index 66b50a4095..ecafa310db 100644 --- a/src/bin/evas/evas_cserve2_index.c +++ b/src/bin/evas/evas_cserve2_index.c | |||
@@ -765,18 +765,19 @@ cserve2_shared_mempool_buffer_ref(Shared_Mempool *sm, int bufferid) | |||
765 | return ie->id; | 765 | return ie->id; |
766 | } | 766 | } |
767 | 767 | ||
768 | static Eina_Bool | 768 | static const void * |
769 | _shared_mempool_buffer_del(Shared_Mempool *sm, int bufferid) | 769 | _shared_mempool_buffer_del(Shared_Mempool *sm, int bufferid) |
770 | { | 770 | { |
771 | Index_Entry *ie; | 771 | Index_Entry *ie; |
772 | const char *data; | ||
772 | 773 | ||
773 | if (!sm || !bufferid) return EINA_FALSE; | 774 | if (!sm || !bufferid) return NULL; |
774 | 775 | ||
775 | ie = _shared_index_entry_get_by_id(sm->index, bufferid); | 776 | ie = _shared_index_entry_get_by_id(sm->index, bufferid); |
776 | if (!ie || ie->refcount <= 0) | 777 | if (!ie || ie->refcount <= 0) |
777 | { | 778 | { |
778 | CRIT("Tried to delete invalid buffer or with refcount 0"); | 779 | CRIT("Tried to delete invalid buffer or with refcount 0"); |
779 | return EINA_FALSE; | 780 | return NULL; |
780 | } | 781 | } |
781 | 782 | ||
782 | ie->refcount--; | 783 | ie->refcount--; |
@@ -789,10 +790,11 @@ _shared_mempool_buffer_del(Shared_Mempool *sm, int bufferid) | |||
789 | sm->empty_blocks = (Block *) eina_rbtree_inline_insert( | 790 | sm->empty_blocks = (Block *) eina_rbtree_inline_insert( |
790 | EINA_RBTREE_GET(sm->empty_blocks), EINA_RBTREE_GET(newblk), | 791 | EINA_RBTREE_GET(sm->empty_blocks), EINA_RBTREE_GET(newblk), |
791 | EINA_RBTREE_CMP_NODE_CB(_block_rbtree_cmp), NULL); | 792 | EINA_RBTREE_CMP_NODE_CB(_block_rbtree_cmp), NULL); |
792 | return EINA_TRUE; | 793 | data = sm->ds->data + ie->offset; |
794 | return data; | ||
793 | } | 795 | } |
794 | 796 | ||
795 | return EINA_FALSE; | 797 | return NULL; |
796 | } | 798 | } |
797 | 799 | ||
798 | void | 800 | void |
@@ -856,7 +858,7 @@ cserve2_shared_string_add(const char *str) | |||
856 | ie = _shared_index_entry_get_by_id(_string_mempool->index, id); | 858 | ie = _shared_index_entry_get_by_id(_string_mempool->index, id); |
857 | if (!ie || ie->refcount <= 0) | 859 | if (!ie || ie->refcount <= 0) |
858 | { | 860 | { |
859 | CRIT("String found in hash but not in mempool!"); | 861 | ERR("String found in hash but not in mempool!"); |
860 | eina_hash_del(_string_entries, str, (void *) (intptr_t) id); | 862 | eina_hash_del(_string_entries, str, (void *) (intptr_t) id); |
861 | goto new_entry; | 863 | goto new_entry; |
862 | } | 864 | } |
@@ -874,9 +876,9 @@ new_entry: | |||
874 | return -1; | 876 | return -1; |
875 | } | 877 | } |
876 | 878 | ||
877 | eina_hash_add(_string_entries, str, (void *) (intptr_t) ie->id); | ||
878 | data = _string_mempool->ds->data + ie->offset; | 879 | data = _string_mempool->ds->data + ie->offset; |
879 | memcpy(data, str, len); | 880 | memcpy(data, str, len); |
881 | eina_hash_add(_string_entries, data, (void *) (intptr_t) ie->id); | ||
880 | return ie->id; | 882 | return ie->id; |
881 | } | 883 | } |
882 | 884 | ||
@@ -890,11 +892,16 @@ cserve2_shared_string_ref(int id) | |||
890 | void | 892 | void |
891 | cserve2_shared_string_del(int id) | 893 | cserve2_shared_string_del(int id) |
892 | { | 894 | { |
895 | const char *data; | ||
896 | |||
893 | if (!id) return; | 897 | if (!id) return; |
894 | if (_shared_mempool_buffer_del(_string_mempool, id)) | 898 | if ((data = _shared_mempool_buffer_del(_string_mempool, id)) != NULL) |
895 | { | 899 | { |
896 | if (!eina_hash_del_by_data(_string_entries, (void *) (intptr_t) id)) | 900 | if (!eina_hash_del_by_key(_string_entries, data)) |
897 | CRIT("Invalid free"); | 901 | { |
902 | if (!eina_hash_del_by_data(_string_entries, (void *) (intptr_t) id)) | ||
903 | CRIT("Invalid free"); | ||
904 | } | ||
898 | } | 905 | } |
899 | } | 906 | } |
900 | 907 | ||