+DEFINE_DESTROYFUNC(user_rec, gom_first_user_rec)
+DEFINE_DELETEFUNC(user_rec)
+DEFINE_GETXREFFUNC(user_rec, XREF_USER)
+
+DEFINE_ADDFUNC2(user_rec, user_data, extra)
+
+/* Specific function, because xrefstr not mandatory here */
+struct user_rec* MAKEFUNC(user_rec)(const char* xrefstr)
+{
+ struct user_rec* rec = NULL;
+ MAKE_CHAIN_ELT(user_rec, gom_first_user_rec, rec);
+ if (rec && xrefstr) {
+ rec->xrefstr = strdup(xrefstr);
+ if (! rec->xrefstr) MEMORY_ERROR;
+ }
+ return rec;
+}
+
+struct user_rec* ADDFUNC(user_rec)(const char* xrefstr, const char* tag)
+{
+ struct user_rec *obj = NULL;
+ struct xref_value* xrv = gedcom_get_by_xref(xrefstr);
+ if (tag && tag[0] == '_') {
+ if (xrv)
+ gom_xref_already_in_use(xrefstr);
+ else {
+ obj = MAKEFUNC(user_rec)(xrefstr);
+ if (obj) {
+ obj->tag = strdup(tag);
+ if (! obj->tag)
+ MEMORY_ERROR;
+ else
+ xrv = gedcom_add_xref(XREF_USER, xrefstr, (Gedcom_ctxt)obj);
+ if (!xrv) {
+ DESTROYFUNC(user_rec)(obj);
+ obj = NULL;
+ }
+ }
+ }
+ }
+ return obj;
+}