ObjFW  Check-in [2ae3bc33e1]

Overview
Comment:runtime: Never use assert()

This results in stdio being linked in when building an Amiga library.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 2ae3bc33e1643e78f22e7c1067121563aa9cea346476d91b428c118a8ccdb652
User & Date: js on 2018-04-30 14:51:49
Other Links: manifest | tags
Context
2018-04-30
16:33
runtime: Call {con,de}structors in Amiga library check-in: ec5dcd5c9e user: js tags: trunk
14:51
runtime: Never use assert() check-in: 2ae3bc33e1 user: js tags: trunk
11:20
runtime: Generate and install Amiga inline header check-in: ec343c7ae6 user: js tags: trunk
Changes

Modified src/runtime/class.m from [8d78186ef9] to [b4196ed858].

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
18
19
20
21
22
23
24


25
26
27
28
29
30
31







-
-







#include "config.h"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>

#include <assert.h>

#import "ObjFW_RT.h"
#import "private.h"

static struct objc_hashtable *classes = NULL;
static unsigned classes_cnt = 0;
static Class *load_queue = NULL;
static size_t load_queue_cnt = 0;
580
581
582
583
584
585
586
587

588
589
590
591
592
593
594
578
579
580
581
582
583
584

585
586
587
588
589
590
591
592







-
+








	objc_global_mutex_lock();

	if ((ret = malloc((classes_cnt + 1) * sizeof(Class))) == NULL)
		OBJC_ERROR("Failed to allocate memory for class list!");

	count = objc_getClassList(ret, classes_cnt);
	assert(count == classes_cnt);
	OF_ENSURE(count == classes_cnt);

	ret[count] = Nil;

	if (len != NULL)
		*len = count;

	objc_global_mutex_unlock();
916
917
918
919
920
921
922
923

924
925
926
927
928
929
930
931
932
933
934
935
914
915
916
917
918
919
920

921
922
923
924
925
926
927
928
929
930
931
932
933







-
+












			 * UINT32_MAX so that it will get increased at the end
			 * of the loop and thus become 0.
			 */
			i = UINT32_MAX;
		}
	}

	assert(classes_cnt == 0);
	OF_ENSURE(classes_cnt == 0);

	if (empty_dtable != NULL) {
		objc_dtable_free(empty_dtable);
		empty_dtable = NULL;
	}

	objc_sparsearray_free(fast_path);
	fast_path = NULL;

	objc_hashtable_free(classes);
	classes = NULL;
}