Check-in [a5e77ffbcf]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:If RAM fails to allocate, cut in half and try again.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a5e77ffbcffba53c3dc183094dfe6a977d6686d2
User & Date: stephanie.gawroriski 2019-07-13 01:36:52
Context
2019-07-13
01:38
Actually link in all the DOS files. check-in: 8e18d64220 user: stephanie.gawroriski tags: trunk
01:36
If RAM fails to allocate, cut in half and try again. check-in: a5e77ffbcf user: stephanie.gawroriski tags: trunk
01:31
Add Palm OS Icon resources. check-in: 612046619c user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ratufacoat/sjmerc.c.

11
12
13
14
15
16
17
18
19

20
21
22
23
24
25
26
27
28
29
....
3039
3040
3041
3042
3043
3044
3045
3046



3047










3048
3049
3050
3051
3052
3053
3054
 *
 * @since 2019/06/02
 */

#include "sjmerc.h"

/** Default RAM size. */
#if defined(SJME_IS_DOS)
	#define SJME_DEFAULT_RAM_SIZE SJME_JINT_C(65536)

#else
	#define SJME_DEFAULT_RAM_SIZE SJME_JINT_C(16777216)
#endif

/** Default size of configuration ROM. */
#define SJME_DEFAULT_CONF_SIZE SJME_JINT_C(65536)

/** Magic number for ROMs. */
#define SJME_ROM_MAGIC_NUMBER SJME_JINT_C(0x58455223)

................................................................................
		options = &nulloptions;
	}
	
	/* If no RAM size was specified then use the default. */
	if (options->ramsize <= 0)
		options->ramsize = SJME_DEFAULT_RAM_SIZE;
	
	/* Allocate RAM. */



	ram = sjme_malloc(options->ramsize);










	if (ram == NULL)
	{
		sjme_seterror(error, SJME_ERROR_NOMEMORY, options->ramsize);
			
		sjme_free(rv);
		sjme_free(conf);
		







<
|
>
|
|
<







 







|
>
>
>
|
>
>
>
>
>
>
>
>
>
>







11
12
13
14
15
16
17

18
19
20
21

22
23
24
25
26
27
28
....
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
 *
 * @since 2019/06/02
 */

#include "sjmerc.h"

/** Default RAM size. */

#define SJME_DEFAULT_RAM_SIZE SJME_JINT_C(16777216)

/** Minimum permitted RAM size. */
#define SJME_MINIMUM_RAM_SIZE SJME_JINT_C(65536)


/** Default size of configuration ROM. */
#define SJME_DEFAULT_CONF_SIZE SJME_JINT_C(65536)

/** Magic number for ROMs. */
#define SJME_ROM_MAGIC_NUMBER SJME_JINT_C(0x58455223)

................................................................................
		options = &nulloptions;
	}
	
	/* If no RAM size was specified then use the default. */
	if (options->ramsize <= 0)
		options->ramsize = SJME_DEFAULT_RAM_SIZE;
	
	/* Allocate RAM, or at least keep trying to. */
	while (options->ramsize >= SJME_MINIMUM_RAM_SIZE)
	{
		/* Attempt to allocate the RAM. */
		ram = sjme_malloc(options->ramsize);
		
		/* Ram allocated! So stop. */
		if (ram != NULL)
			break;
		
		/* Cut RAM allocation size down in half. */
		options->ramsize /= 2;
	}
	
	/* Failed to allocate the RAM. */
	if (ram == NULL)
	{
		sjme_seterror(error, SJME_ERROR_NOMEMORY, options->ramsize);
			
		sjme_free(rv);
		sjme_free(conf);