ObjFW  Diff

Differences From Artifact [41e131467f]:

  • File src/macros.h — part of check-in [c1fe4b2b77] at 2020-07-12 09:49:35 on branch trunk — Make of_random() a function

    When arc4random() is unavailable, either random() or rand() is used and
    both need to be seeded. If of_random() is a macro, it needs to be
    (re)seeded every time, as it's unknown whether it has already been
    seeded. As it is seeded with gettimeofday() due to the lack of a better
    initial seed, this means every call returns the first state for the
    current time, which is very predictable. random() and rand() are both
    not cryptographic, but this should at least make it a little bit better
    now. (user: js, size: 21483) [annotate] [blame] [check-ins using] [more...]

To Artifact [0f3365fd01]:


132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#define OF_PREPROCESSOR_CONCAT(a, b) OF_PREPROCESSOR_CONCAT2(a, b)

#if __OBJFW_RUNTIME_ABI__ || (defined(OF_APPLE_RUNTIME) && defined(__OBJC2__))
# define OF_HAVE_NONFRAGILE_IVARS
#endif

#ifdef OF_HAVE_NONFRAGILE_IVARS
# define OF_RESERVE_IVARS(num)
#else
# define OF_RESERVE_IVARS(num)						   \
	@private							   \
		void *OF_PREPROCESSOR_CONCAT(_reserved, __COUNTER__)[num];
#endif

#ifdef __GNUC__
# define OF_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
#else
# define OF_GCC_VERSION 0
#endif







|

|

|







132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#define OF_PREPROCESSOR_CONCAT(a, b) OF_PREPROCESSOR_CONCAT2(a, b)

#if __OBJFW_RUNTIME_ABI__ || (defined(OF_APPLE_RUNTIME) && defined(__OBJC2__))
# define OF_HAVE_NONFRAGILE_IVARS
#endif

#ifdef OF_HAVE_NONFRAGILE_IVARS
# define OF_RESERVE_IVARS(cls, num)
#else
# define OF_RESERVE_IVARS(cls, num)					   \
	@private							   \
		void *OF_PREPROCESSOR_CONCAT(_reserved_, cls)[num];
#endif

#ifdef __GNUC__
# define OF_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
#else
# define OF_GCC_VERSION 0
#endif