ObjFW  Diff

Differences From Artifact [979b29ef70]:

To Artifact [7827e43c55]:

  • File src/runtime/arc.m — part of check-in [ef6d69931e] at 2019-02-07 00:46:41 on branch trunk — Make style consistent between ObjFW and ObjFW_RT

    ObjFW_RT used to be a separate project that followed the BSD style, as
    it was written in pure C, while ObjFW's style is based on the BSD style
    with changes to make it a better fit for Objective-C. This commit
    changes ObjFW_RT to use the same style as ObjFW. (user: js, size: 5556) [annotate] [blame] [check-ins using]


34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61

static struct objc_hashtable *hashtable;
#ifdef OF_HAVE_THREADS
static of_spinlock_t spinlock;
#endif

static uint32_t
obj_hash(const void *obj)
{
	return (uint32_t)(uintptr_t)obj;
}

static bool
obj_equal(const void *obj1, const void *obj2)
{
	return (obj1 == obj2);
}

OF_CONSTRUCTOR()
{
	hashtable = objc_hashtable_new(obj_hash, obj_equal, 2);

#ifdef OF_HAVE_THREADS
	if (!of_spinlock_new(&spinlock))
		OBJC_ERROR("Failed to create spinlock!")
#endif
}








|





|






|







34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61

static struct objc_hashtable *hashtable;
#ifdef OF_HAVE_THREADS
static of_spinlock_t spinlock;
#endif

static uint32_t
hash(const void *obj)
{
	return (uint32_t)(uintptr_t)obj;
}

static bool
equal(const void *obj1, const void *obj2)
{
	return (obj1 == obj2);
}

OF_CONSTRUCTOR()
{
	hashtable = objc_hashtable_new(hash, equal, 2);

#ifdef OF_HAVE_THREADS
	if (!of_spinlock_new(&spinlock))
		OBJC_ERROR("Failed to create spinlock!")
#endif
}