Changeset: ffce3f467a54 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ffce3f467a54
Modified Files:
        gdk/gdk_atoms.c
        gdk/gdk_private.h
Branch: default
Log Message:

Cleanup some atom name code.
Removed unused function ATOMunknown_del.


diffs (74 lines):

diff --git a/gdk/gdk_atoms.c b/gdk/gdk_atoms.c
--- a/gdk/gdk_atoms.c
+++ b/gdk/gdk_atoms.c
@@ -178,7 +178,7 @@ ATOMallocate(const char *id)
                if (strlen(id) >= IDLENGTH)
                        GDKfatal("ATOMallocate: name too long");
                memset(BATatoms + t, 0, sizeof(atomDesc));
-               snprintf(BATatoms[t].name, IDLENGTH, "%s", id);
+               snprintf(BATatoms[t].name, sizeof(BATatoms[t].name), "%s", id);
                BATatoms[t].size = sizeof(int);         /* default */
                BATatoms[t].align = sizeof(int);        /* default */
                BATatoms[t].linear = 1;                 /* default */
@@ -2069,30 +2069,21 @@ int GDKatomcnt = TYPE_str + 1;
  * interface. Finding an (negative) atom index can be done via
  * ATOMunknown_find, which simply adds the atom if it's not in the
  * unknown set. The index van be used to find the name of an unknown
- * ATOM via ATOMunknown_name. Once an atom becomes known, ie the
- * module defining it is loaded, it should be removed from the unknown
- * set using ATOMunknown_del.
+ * ATOM via ATOMunknown_name.
  */
 static str unknown[MAXATOMS] = { NULL };
 
 int
-ATOMunknown_del(int i)
-{
-       assert(unknown[-i]);
-       GDKfree(unknown[-i]);
-       unknown[-i] = NULL;
-       return 0;
-}
-
-int
 ATOMunknown_find(const char *nme)
 {
        int i, j = 0;
 
        /* first try to find the atom */
+       MT_lock_set(&GDKthreadLock);
        for (i = 1; i < MAXATOMS; i++) {
                if (unknown[i]) {
                        if (strcmp(unknown[i], nme) == 0) {
+                               MT_lock_unset(&GDKthreadLock);
                                return -i;
                        }
                } else if (j == 0)
@@ -2100,10 +2091,14 @@ ATOMunknown_find(const char *nme)
        }
        if (j == 0) {
                /* no space for new atom (shouldn't happen) */
+               MT_lock_unset(&GDKthreadLock);
                return 0;
        }
-       if ((unknown[j] = GDKstrdup(nme)) == NULL)
+       if ((unknown[j] = GDKstrdup(nme)) == NULL) {
+               MT_lock_unset(&GDKthreadLock);
                return 0;
+       }
+       MT_lock_unset(&GDKthreadLock);
        return -j;
 }
 
diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h
--- a/gdk/gdk_private.h
+++ b/gdk/gdk_private.h
@@ -31,8 +31,6 @@ enum heaptype {
        __attribute__((__visibility__("hidden")));
 __hidden int ATOMisdescendant(int id, int parentid)
        __attribute__((__visibility__("hidden")));
-__hidden int ATOMunknown_del(int a)
-       __attribute__((__visibility__("hidden")));
 __hidden int ATOMunknown_find(const char *nme)
        __attribute__ ((__warn_unused_result__))
        __attribute__((__visibility__("hidden")));
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to