forked from pete-gordon/hivelytracker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutil.c
executable file
·46 lines (41 loc) · 1.05 KB
/
util.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <stdio.h>
#include <system_includes.h>
#ifndef __SDL_WRAPPER__
/*
** A small routine to open a library and get its default
** interface, and report errors if anything fails.
*/
#ifdef __amigaos4__
BOOL getLibIFace( struct Library **libbase, TEXT *libname, uint32 version, void *ifaceptr )
{
struct Interface **ifptr = (struct Interface **)ifaceptr;
*libbase = IExec->OpenLibrary( libname, version );
if( *libbase == NULL )
{
printf( "Unable to open '%s' version %ld\n", libname, version );
return FALSE;
}
*ifptr = IExec->GetInterface( *libbase, "main", 1, NULL );
if( *ifptr == NULL )
{
printf( "Unable to get the main interface for '%s'\n", libname );
return FALSE;
}
return TRUE;
}
#endif
#endif
struct Node *allocnode(int32 size)
{
#ifndef __SDL_WRAPPER__
#ifdef __amigaos4__
return IExec->AllocSysObjectTags(ASOT_NODE, ASONODE_Size, size, TAG_DONE);
#else
return AllocVec(size, MEMF_PUBLIC);
#endif
#else
struct Node *ptr = malloc(size);
if (ptr) memset(ptr, 0, sizeof(struct Node));
return ptr;
#endif
}