summaryrefslogtreecommitdiff
path: root/src/hb-set.cc
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2012-06-05 12:31:51 -0400
committerBehdad Esfahbod <behdad@behdad.org>2012-06-05 14:49:14 -0400
commitf06ab8a4262c759b4723614fd28f55ee77aa8466 (patch)
treebe463572fd6ebe73bc42ae79ed8aece7c685d38a /src/hb-set.cc
parentbf93b636c4963cbc32d5fba7ace1053db6719192 (diff)
Better hide nil objects and make them const
Diffstat (limited to 'src/hb-set.cc')
-rw-r--r--src/hb-set.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/hb-set.cc b/src/hb-set.cc
index 50453860..a044199b 100644
--- a/src/hb-set.cc
+++ b/src/hb-set.cc
@@ -30,12 +30,6 @@
/* Public API */
-static hb_set_t _hb_set_nil = {
- HB_OBJECT_HEADER_STATIC,
-
- {0} /* elts */
-};
-
hb_set_t *
hb_set_create ()
@@ -43,7 +37,7 @@ hb_set_create ()
hb_set_t *set;
if (!(set = hb_object_create<hb_set_t> ()))
- return &_hb_set_nil;
+ return hb_set_get_empty ();
set->clear ();
@@ -53,7 +47,13 @@ hb_set_create ()
hb_set_t *
hb_set_get_empty (void)
{
- return &_hb_set_nil;
+ static const hb_set_t _hb_set_nil = {
+ HB_OBJECT_HEADER_STATIC,
+
+ {0} /* elts */
+ };
+
+ return const_cast<hb_set_t *> (&_hb_set_nil);
}
hb_set_t *