exported the callbacks, and added convenience macros
[rrq/rrqmisc.git] / vector / tupleitem.c
index ad1326735e816c5fa7989378c8e0f1fcfe81bb69..55328c5446624abda6224bc07993acfcaacdc0c9 100644 (file)
@@ -112,15 +112,17 @@ tuple *tuple_create(int arity,...) {
     return t;
 }
 
+itemkeyfun tupleschema_callbacks = {
+    .hashcode = tupleitem_hashcode,
+    .haskey = tupleitem_haskey,
+    .itemkey = tupleitem_itemkey,
+    .releasekey = tupleitem_releasekey
+};
+
 tupleschema *tupleschema_create(int arity,tuple *columns) {
     tupleschema *ts = (tupleschema*) malloc( sizeof( tupleschema ) );
     (*ts) = (tupleschema) {
-       .base = {
-           .hashcode = tupleitem_hashcode,
-           .haskey = tupleitem_haskey,
-           .itemkey = tupleitem_itemkey,
-           .releasekey = tupleitem_releasekey
-       },
+       .base = tupleschema_callbacks,
        .arity = arity,
        .columns = (itemkeyfun**) columns
     };