blob: bce0cba1a445f798a768c217003863fd2be3e140 (
plain)
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
47
48
49
50
51
52
53
54
55
56
57
|
#include "fitz.h"
static fz_obj *
fz_resolve_indirect_null(fz_obj *ref)
{
return ref;
}
fz_obj *(*fz_resolve_indirect)(fz_obj*) = fz_resolve_indirect_null;
void
fz_free_context(fz_context *ctx)
{
assert(ctx != NULL);
/* Other finalisation calls go here (in reverse order) */
if (ctx->error)
{
assert(ctx->error->top == -1);
free(ctx->error);
}
/* Free the context itself */
free(ctx);
}
fz_context *
fz_new_context(void)
{
fz_context *ctx;
ctx = malloc(sizeof(fz_context));
if (!ctx)
return NULL;
ctx->error = malloc(sizeof(fz_error_context));
if (!ctx->error)
goto cleanup;
ctx->error->top = -1;
ctx->error->message[0] = 0;
/* New initialisation calls for context entries go here */
return ctx;
cleanup:
fprintf(stderr, "cannot create context\n");
fz_free_context(ctx);
return NULL;
}
fz_context *
fz_clone_context(fz_context *ctx)
{
return fz_new_context();
}
|