diff options
author | David Walter Seikel | 2012-04-22 09:19:23 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-04-22 09:19:23 +1000 |
commit | c963d75dfdeec11f82e79e727062fbf89afa2c04 (patch) | |
tree | 895633dbf641110be46f117c29890c49b3ffc0bd /libraries/eina/src/lib/eina_share_common.c | |
parent | Adding the new extantz viewer and grid manager. (diff) | |
download | SledjHamr-c963d75dfdeec11f82e79e727062fbf89afa2c04.zip SledjHamr-c963d75dfdeec11f82e79e727062fbf89afa2c04.tar.gz SledjHamr-c963d75dfdeec11f82e79e727062fbf89afa2c04.tar.bz2 SledjHamr-c963d75dfdeec11f82e79e727062fbf89afa2c04.tar.xz |
Update EFL to latest beta.
Diffstat (limited to 'libraries/eina/src/lib/eina_share_common.c')
-rw-r--r-- | libraries/eina/src/lib/eina_share_common.c | 42 |
1 files changed, 7 insertions, 35 deletions
diff --git a/libraries/eina/src/lib/eina_share_common.c b/libraries/eina/src/lib/eina_share_common.c index 90e1868..776e429 100644 --- a/libraries/eina/src/lib/eina_share_common.c +++ b/libraries/eina/src/lib/eina_share_common.c | |||
@@ -76,7 +76,6 @@ | |||
76 | #include "eina_hash.h" | 76 | #include "eina_hash.h" |
77 | #include "eina_rbtree.h" | 77 | #include "eina_rbtree.h" |
78 | #include "eina_error.h" | 78 | #include "eina_error.h" |
79 | #include "eina_log.h" | ||
80 | #include "eina_lock.h" | 79 | #include "eina_lock.h" |
81 | 80 | ||
82 | /* undefs EINA_ARG_NONULL() so NULL checks are not compiled out! */ | 81 | /* undefs EINA_ARG_NONULL() so NULL checks are not compiled out! */ |
@@ -126,8 +125,6 @@ typedef struct _Eina_Share_Common Eina_Share_Common; | |||
126 | typedef struct _Eina_Share_Common_Node Eina_Share_Common_Node; | 125 | typedef struct _Eina_Share_Common_Node Eina_Share_Common_Node; |
127 | typedef struct _Eina_Share_Common_Head Eina_Share_Common_Head; | 126 | typedef struct _Eina_Share_Common_Head Eina_Share_Common_Head; |
128 | 127 | ||
129 | int _eina_share_common_log_dom = -1; | ||
130 | |||
131 | struct _Eina_Share | 128 | struct _Eina_Share |
132 | { | 129 | { |
133 | Eina_Share_Common *share; | 130 | Eina_Share_Common *share; |
@@ -600,28 +597,8 @@ eina_share_common_init(Eina_Share **_share, | |||
600 | share = *_share = calloc(sizeof(Eina_Share), 1); | 597 | share = *_share = calloc(sizeof(Eina_Share), 1); |
601 | if (!share) goto on_error; | 598 | if (!share) goto on_error; |
602 | 599 | ||
603 | if (_eina_share_common_log_dom < 0) /*Only register if not already */ | ||
604 | _eina_share_common_log_dom = eina_log_domain_register( | ||
605 | "eina_share", | ||
606 | EINA_LOG_COLOR_DEFAULT); | ||
607 | |||
608 | if (_eina_share_common_log_dom < 0) | ||
609 | { | ||
610 | EINA_LOG_ERR("Could not register log domain: eina_share_common"); | ||
611 | goto on_error; | ||
612 | } | ||
613 | |||
614 | share->share = calloc(1, sizeof(Eina_Share_Common)); | 600 | share->share = calloc(1, sizeof(Eina_Share_Common)); |
615 | if (!share->share) | 601 | if (!share->share) goto on_error; |
616 | { | ||
617 | if (_eina_share_common_log_dom > 0) | ||
618 | { | ||
619 | eina_log_domain_unregister(_eina_share_common_log_dom); | ||
620 | _eina_share_common_log_dom = -1; | ||
621 | } | ||
622 | |||
623 | goto on_error; | ||
624 | } | ||
625 | 602 | ||
626 | share->node_magic = node_magic; | 603 | share->node_magic = node_magic; |
627 | #define EMS(n) eina_magic_string_static_set(n, n ## _STR) | 604 | #define EMS(n) eina_magic_string_static_set(n, n ## _STR) |
@@ -678,11 +655,6 @@ eina_share_common_shutdown(Eina_Share **_share) | |||
678 | MAGIC_FREE(share->share); | 655 | MAGIC_FREE(share->share); |
679 | 656 | ||
680 | _eina_share_common_population_shutdown(share); | 657 | _eina_share_common_population_shutdown(share); |
681 | if (_eina_share_common_log_dom > 0) /* Only free if necessary */ | ||
682 | { | ||
683 | eina_log_domain_unregister(_eina_share_common_log_dom); | ||
684 | _eina_share_common_log_dom = -1; | ||
685 | } | ||
686 | 658 | ||
687 | eina_lock_release(&_mutex_big); | 659 | eina_lock_release(&_mutex_big); |
688 | 660 | ||
@@ -833,7 +805,7 @@ eina_share_common_ref(Eina_Share *share, const char *str) | |||
833 | } | 805 | } |
834 | 806 | ||
835 | 807 | ||
836 | void | 808 | Eina_Bool |
837 | eina_share_common_del(Eina_Share *share, const char *str) | 809 | eina_share_common_del(Eina_Share *share, const char *str) |
838 | { | 810 | { |
839 | unsigned int slen; | 811 | unsigned int slen; |
@@ -843,7 +815,7 @@ eina_share_common_del(Eina_Share *share, const char *str) | |||
843 | int hash_num, hash; | 815 | int hash_num, hash; |
844 | 816 | ||
845 | if (!str) | 817 | if (!str) |
846 | return; | 818 | return EINA_TRUE; |
847 | 819 | ||
848 | eina_lock_take(&_mutex_big); | 820 | eina_lock_take(&_mutex_big); |
849 | 821 | ||
@@ -857,7 +829,7 @@ eina_share_common_del(Eina_Share *share, const char *str) | |||
857 | { | 829 | { |
858 | node->references--; | 830 | node->references--; |
859 | eina_lock_release(&_mutex_big); | 831 | eina_lock_release(&_mutex_big); |
860 | return; | 832 | return EINA_TRUE; |
861 | } | 833 | } |
862 | 834 | ||
863 | node->references = 0; | 835 | node->references = 0; |
@@ -871,7 +843,7 @@ eina_share_common_del(Eina_Share *share, const char *str) | |||
871 | if (!ed) | 843 | if (!ed) |
872 | goto on_error; | 844 | goto on_error; |
873 | 845 | ||
874 | EINA_MAGIC_CHECK_SHARE_COMMON_HEAD(ed, eina_lock_release(&_mutex_big)); | 846 | EINA_MAGIC_CHECK_SHARE_COMMON_HEAD(ed, eina_lock_release(&_mutex_big), EINA_FALSE); |
875 | 847 | ||
876 | if (!_eina_share_common_head_remove_node(ed, node)) | 848 | if (!_eina_share_common_head_remove_node(ed, node)) |
877 | goto on_error; | 849 | goto on_error; |
@@ -886,12 +858,12 @@ eina_share_common_del(Eina_Share *share, const char *str) | |||
886 | 858 | ||
887 | eina_lock_release(&_mutex_big); | 859 | eina_lock_release(&_mutex_big); |
888 | 860 | ||
889 | return; | 861 | return EINA_TRUE; |
890 | 862 | ||
891 | on_error: | 863 | on_error: |
892 | eina_lock_release(&_mutex_big); | 864 | eina_lock_release(&_mutex_big); |
893 | /* possible segfault happened before here, but... */ | 865 | /* possible segfault happened before here, but... */ |
894 | CRITICAL("EEEK trying to del non-shared share_common \"%s\"", str); | 866 | return EINA_FALSE; |
895 | } | 867 | } |
896 | 868 | ||
897 | int | 869 | int |