Coverage Report

Created: 2025-06-10 07:27

/src/ghostpdl/pdf/pdf_stack.h
Line
Count
Source
1
/* Copyright (C) 2018-2025 Artifex Software, Inc.
2
   All Rights Reserved.
3
4
   This software is provided AS-IS with no warranty, either express or
5
   implied.
6
7
   This software is distributed under license and may not be copied,
8
   modified or distributed except as expressly authorized under the terms
9
   of the license contained in the file LICENSE in this distribution.
10
11
   Refer to licensing information at http://www.artifex.com or contact
12
   Artifex Software, Inc.,  39 Mesa Street, Suite 108A, San Francisco,
13
   CA 94129, USA, for further information.
14
*/
15
16
/* Stack operations for the PDF interpreter */
17
18
#ifndef PDF_STACK_OPERATIONS
19
#define PDF_STACK_OPERATIONS
20
21
#include "pdf_int.h"
22
#include "pdf_types.h"
23
#include "ghostpdf.h"
24
#include "pdf_obj.h"
25
26
int pdfi_pop(pdf_context *ctx, int num);
27
int pdfi_push(pdf_context *ctx, pdf_obj *o);
28
int pdfi_mark_stack(pdf_context *ctx, pdf_obj_type type);
29
void pdfi_clearstack(pdf_context *ctx);
30
int pdfi_count_to_mark(pdf_context *ctx, uint64_t *count);
31
int pdfi_clear_to_mark(pdf_context *ctx);
32
int pdfi_destack_real(pdf_context *ctx, double *d);
33
int pdfi_destack_reals(pdf_context *ctx, double *d, int n);
34
int pdfi_destack_floats(pdf_context *ctx, float *d, int n);
35
int pdfi_destack_int(pdf_context *ctx, int64_t *i);
36
int pdfi_destack_ints(pdf_context *ctx, int64_t *i, int n);
37
38
static inline void pdfi_countup_impl(pdf_obj *o)
39
92.5M
{
40
92.5M
    if ((uintptr_t)o < TOKEN__LAST_KEY)
41
8.13M
    {
42
#if REFCNT_DEBUG
43
        if (o == NULL)
44
            dprintf("Incrementing reference count of NULL pointer\n");
45
#endif
46
8.13M
        return;
47
8.13M
    }
48
84.3M
    o->refcnt++;
49
#if REFCNT_DEBUG
50
    outprintf(ctx->memory, "Incrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
51
#endif
52
84.3M
}
Unexecuted instantiation: zpdfops.c:pdfi_countup_impl
ghostpdf.c:pdfi_countup_impl
Line
Count
Source
39
2.99k
{
40
2.99k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
41
0
    {
42
#if REFCNT_DEBUG
43
        if (o == NULL)
44
            dprintf("Incrementing reference count of NULL pointer\n");
45
#endif
46
0
        return;
47
0
    }
48
2.99k
    o->refcnt++;
49
#if REFCNT_DEBUG
50
    outprintf(ctx->memory, "Incrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
51
#endif
52
2.99k
}
pdf_dict.c:pdfi_countup_impl
Line
Count
Source
39
15.6M
{
40
15.6M
    if ((uintptr_t)o < TOKEN__LAST_KEY)
41
117k
    {
42
#if REFCNT_DEBUG
43
        if (o == NULL)
44
            dprintf("Incrementing reference count of NULL pointer\n");
45
#endif
46
117k
        return;
47
117k
    }
48
15.5M
    o->refcnt++;
49
#if REFCNT_DEBUG
50
    outprintf(ctx->memory, "Incrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
51
#endif
52
15.5M
}
pdf_array.c:pdfi_countup_impl
Line
Count
Source
39
23.8M
{
40
23.8M
    if ((uintptr_t)o < TOKEN__LAST_KEY)
41
71.8k
    {
42
#if REFCNT_DEBUG
43
        if (o == NULL)
44
            dprintf("Incrementing reference count of NULL pointer\n");
45
#endif
46
71.8k
        return;
47
71.8k
    }
48
23.7M
    o->refcnt++;
49
#if REFCNT_DEBUG
50
    outprintf(ctx->memory, "Incrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
51
#endif
52
23.7M
}
pdf_xref.c:pdfi_countup_impl
Line
Count
Source
39
3.14k
{
40
3.14k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
41
0
    {
42
#if REFCNT_DEBUG
43
        if (o == NULL)
44
            dprintf("Incrementing reference count of NULL pointer\n");
45
#endif
46
0
        return;
47
0
    }
48
3.14k
    o->refcnt++;
49
#if REFCNT_DEBUG
50
    outprintf(ctx->memory, "Incrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
51
#endif
52
3.14k
}
Unexecuted instantiation: pdf_int.c:pdfi_countup_impl
Unexecuted instantiation: pdf_file.c:pdfi_countup_impl
Unexecuted instantiation: pdf_path.c:pdfi_countup_impl
pdf_colour.c:pdfi_countup_impl
Line
Count
Source
39
39.7k
{
40
39.7k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
41
0
    {
42
#if REFCNT_DEBUG
43
        if (o == NULL)
44
            dprintf("Incrementing reference count of NULL pointer\n");
45
#endif
46
0
        return;
47
0
    }
48
39.7k
    o->refcnt++;
49
#if REFCNT_DEBUG
50
    outprintf(ctx->memory, "Incrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
51
#endif
52
39.7k
}
pdf_pattern.c:pdfi_countup_impl
Line
Count
Source
39
3.43k
{
40
3.43k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
41
458
    {
42
#if REFCNT_DEBUG
43
        if (o == NULL)
44
            dprintf("Incrementing reference count of NULL pointer\n");
45
#endif
46
458
        return;
47
458
    }
48
2.97k
    o->refcnt++;
49
#if REFCNT_DEBUG
50
    outprintf(ctx->memory, "Incrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
51
#endif
52
2.97k
}
pdf_gstate.c:pdfi_countup_impl
Line
Count
Source
39
3.92M
{
40
3.92M
    if ((uintptr_t)o < TOKEN__LAST_KEY)
41
967k
    {
42
#if REFCNT_DEBUG
43
        if (o == NULL)
44
            dprintf("Incrementing reference count of NULL pointer\n");
45
#endif
46
967k
        return;
47
967k
    }
48
2.96M
    o->refcnt++;
49
#if REFCNT_DEBUG
50
    outprintf(ctx->memory, "Incrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
51
#endif
52
2.96M
}
pdf_stack.c:pdfi_countup_impl
Line
Count
Source
39
38.6M
{
40
38.6M
    if ((uintptr_t)o < TOKEN__LAST_KEY)
41
6.74M
    {
42
#if REFCNT_DEBUG
43
        if (o == NULL)
44
            dprintf("Incrementing reference count of NULL pointer\n");
45
#endif
46
6.74M
        return;
47
6.74M
    }
48
31.9M
    o->refcnt++;
49
#if REFCNT_DEBUG
50
    outprintf(ctx->memory, "Incrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
51
#endif
52
31.9M
}
pdf_image.c:pdfi_countup_impl
Line
Count
Source
39
53.7k
{
40
53.7k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
41
0
    {
42
#if REFCNT_DEBUG
43
        if (o == NULL)
44
            dprintf("Incrementing reference count of NULL pointer\n");
45
#endif
46
0
        return;
47
0
    }
48
53.7k
    o->refcnt++;
49
#if REFCNT_DEBUG
50
    outprintf(ctx->memory, "Incrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
51
#endif
52
53.7k
}
pdf_page.c:pdfi_countup_impl
Line
Count
Source
39
24.3k
{
40
24.3k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
41
0
    {
42
#if REFCNT_DEBUG
43
        if (o == NULL)
44
            dprintf("Incrementing reference count of NULL pointer\n");
45
#endif
46
0
        return;
47
0
    }
48
24.3k
    o->refcnt++;
49
#if REFCNT_DEBUG
50
    outprintf(ctx->memory, "Incrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
51
#endif
52
24.3k
}
pdf_annot.c:pdfi_countup_impl
Line
Count
Source
39
13.9k
{
40
13.9k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
41
0
    {
42
#if REFCNT_DEBUG
43
        if (o == NULL)
44
            dprintf("Incrementing reference count of NULL pointer\n");
45
#endif
46
0
        return;
47
0
    }
48
13.9k
    o->refcnt++;
49
#if REFCNT_DEBUG
50
    outprintf(ctx->memory, "Incrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
51
#endif
52
13.9k
}
Unexecuted instantiation: pdf_mark.c:pdfi_countup_impl
pdf_font.c:pdfi_countup_impl
Line
Count
Source
39
2.76M
{
40
2.76M
    if ((uintptr_t)o < TOKEN__LAST_KEY)
41
0
    {
42
#if REFCNT_DEBUG
43
        if (o == NULL)
44
            dprintf("Incrementing reference count of NULL pointer\n");
45
#endif
46
0
        return;
47
0
    }
48
2.76M
    o->refcnt++;
49
#if REFCNT_DEBUG
50
    outprintf(ctx->memory, "Incrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
51
#endif
52
2.76M
}
pdf_font0.c:pdfi_countup_impl
Line
Count
Source
39
1.36k
{
40
1.36k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
41
0
    {
42
#if REFCNT_DEBUG
43
        if (o == NULL)
44
            dprintf("Incrementing reference count of NULL pointer\n");
45
#endif
46
0
        return;
47
0
    }
48
1.36k
    o->refcnt++;
49
#if REFCNT_DEBUG
50
    outprintf(ctx->memory, "Incrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
51
#endif
52
1.36k
}
pdf_font1.c:pdfi_countup_impl
Line
Count
Source
39
635k
{
40
635k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
41
230k
    {
42
#if REFCNT_DEBUG
43
        if (o == NULL)
44
            dprintf("Incrementing reference count of NULL pointer\n");
45
#endif
46
230k
        return;
47
230k
    }
48
404k
    o->refcnt++;
49
#if REFCNT_DEBUG
50
    outprintf(ctx->memory, "Incrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
51
#endif
52
404k
}
pdf_font1C.c:pdfi_countup_impl
Line
Count
Source
39
141k
{
40
141k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
41
258
    {
42
#if REFCNT_DEBUG
43
        if (o == NULL)
44
            dprintf("Incrementing reference count of NULL pointer\n");
45
#endif
46
258
        return;
47
258
    }
48
141k
    o->refcnt++;
49
#if REFCNT_DEBUG
50
    outprintf(ctx->memory, "Incrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
51
#endif
52
141k
}
pdf_fontps.c:pdfi_countup_impl
Line
Count
Source
39
4.75M
{
40
4.75M
    if ((uintptr_t)o < TOKEN__LAST_KEY)
41
0
    {
42
#if REFCNT_DEBUG
43
        if (o == NULL)
44
            dprintf("Incrementing reference count of NULL pointer\n");
45
#endif
46
0
        return;
47
0
    }
48
4.75M
    o->refcnt++;
49
#if REFCNT_DEBUG
50
    outprintf(ctx->memory, "Incrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
51
#endif
52
4.75M
}
pdf_font3.c:pdfi_countup_impl
Line
Count
Source
39
309
{
40
309
    if ((uintptr_t)o < TOKEN__LAST_KEY)
41
0
    {
42
#if REFCNT_DEBUG
43
        if (o == NULL)
44
            dprintf("Incrementing reference count of NULL pointer\n");
45
#endif
46
0
        return;
47
0
    }
48
309
    o->refcnt++;
49
#if REFCNT_DEBUG
50
    outprintf(ctx->memory, "Incrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
51
#endif
52
309
}
pdf_fontTT.c:pdfi_countup_impl
Line
Count
Source
39
193k
{
40
193k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
41
1.60k
    {
42
#if REFCNT_DEBUG
43
        if (o == NULL)
44
            dprintf("Incrementing reference count of NULL pointer\n");
45
#endif
46
1.60k
        return;
47
1.60k
    }
48
191k
    o->refcnt++;
49
#if REFCNT_DEBUG
50
    outprintf(ctx->memory, "Incrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
51
#endif
52
191k
}
pdf_font11.c:pdfi_countup_impl
Line
Count
Source
39
3.97k
{
40
3.97k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
41
0
    {
42
#if REFCNT_DEBUG
43
        if (o == NULL)
44
            dprintf("Incrementing reference count of NULL pointer\n");
45
#endif
46
0
        return;
47
0
    }
48
3.97k
    o->refcnt++;
49
#if REFCNT_DEBUG
50
    outprintf(ctx->memory, "Incrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
51
#endif
52
3.97k
}
pdf_cmap.c:pdfi_countup_impl
Line
Count
Source
39
31
{
40
31
    if ((uintptr_t)o < TOKEN__LAST_KEY)
41
0
    {
42
#if REFCNT_DEBUG
43
        if (o == NULL)
44
            dprintf("Incrementing reference count of NULL pointer\n");
45
#endif
46
0
        return;
47
0
    }
48
31
    o->refcnt++;
49
#if REFCNT_DEBUG
50
    outprintf(ctx->memory, "Incrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
51
#endif
52
31
}
pdf_fmap.c:pdfi_countup_impl
Line
Count
Source
39
6.14k
{
40
6.14k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
41
0
    {
42
#if REFCNT_DEBUG
43
        if (o == NULL)
44
            dprintf("Incrementing reference count of NULL pointer\n");
45
#endif
46
0
        return;
47
0
    }
48
6.14k
    o->refcnt++;
49
#if REFCNT_DEBUG
50
    outprintf(ctx->memory, "Incrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
51
#endif
52
6.14k
}
pdf_text.c:pdfi_countup_impl
Line
Count
Source
39
318k
{
40
318k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
41
0
    {
42
#if REFCNT_DEBUG
43
        if (o == NULL)
44
            dprintf("Incrementing reference count of NULL pointer\n");
45
#endif
46
0
        return;
47
0
    }
48
318k
    o->refcnt++;
49
#if REFCNT_DEBUG
50
    outprintf(ctx->memory, "Incrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
51
#endif
52
318k
}
pdf_shading.c:pdfi_countup_impl
Line
Count
Source
39
10.9k
{
40
10.9k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
41
0
    {
42
#if REFCNT_DEBUG
43
        if (o == NULL)
44
            dprintf("Incrementing reference count of NULL pointer\n");
45
#endif
46
0
        return;
47
0
    }
48
10.9k
    o->refcnt++;
49
#if REFCNT_DEBUG
50
    outprintf(ctx->memory, "Incrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
51
#endif
52
10.9k
}
Unexecuted instantiation: pdf_func.c:pdfi_countup_impl
Unexecuted instantiation: pdf_trans.c:pdfi_countup_impl
Unexecuted instantiation: pdf_device.c:pdfi_countup_impl
Unexecuted instantiation: pdf_misc.c:pdfi_countup_impl
pdf_optcontent.c:pdfi_countup_impl
Line
Count
Source
39
70.0k
{
40
70.0k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
41
0
    {
42
#if REFCNT_DEBUG
43
        if (o == NULL)
44
            dprintf("Incrementing reference count of NULL pointer\n");
45
#endif
46
0
        return;
47
0
    }
48
70.0k
    o->refcnt++;
49
#if REFCNT_DEBUG
50
    outprintf(ctx->memory, "Incrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
51
#endif
52
70.0k
}
Unexecuted instantiation: pdf_check.c:pdfi_countup_impl
pdf_sec.c:pdfi_countup_impl
Line
Count
Source
39
2.79k
{
40
2.79k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
41
0
    {
42
#if REFCNT_DEBUG
43
        if (o == NULL)
44
            dprintf("Incrementing reference count of NULL pointer\n");
45
#endif
46
0
        return;
47
0
    }
48
2.79k
    o->refcnt++;
49
#if REFCNT_DEBUG
50
    outprintf(ctx->memory, "Incrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
51
#endif
52
2.79k
}
Unexecuted instantiation: pdf_utf8.c:pdfi_countup_impl
pdf_deref.c:pdfi_countup_impl
Line
Count
Source
39
467k
{
40
467k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
41
73
    {
42
#if REFCNT_DEBUG
43
        if (o == NULL)
44
            dprintf("Incrementing reference count of NULL pointer\n");
45
#endif
46
73
        return;
47
73
    }
48
467k
    o->refcnt++;
49
#if REFCNT_DEBUG
50
    outprintf(ctx->memory, "Incrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
51
#endif
52
467k
}
pdf_repair.c:pdfi_countup_impl
Line
Count
Source
39
11.1k
{
40
11.1k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
41
0
    {
42
#if REFCNT_DEBUG
43
        if (o == NULL)
44
            dprintf("Incrementing reference count of NULL pointer\n");
45
#endif
46
0
        return;
47
0
    }
48
11.1k
    o->refcnt++;
49
#if REFCNT_DEBUG
50
    outprintf(ctx->memory, "Incrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
51
#endif
52
11.1k
}
pdf_obj.c:pdfi_countup_impl
Line
Count
Source
39
155k
{
40
155k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
41
0
    {
42
#if REFCNT_DEBUG
43
        if (o == NULL)
44
            dprintf("Incrementing reference count of NULL pointer\n");
45
#endif
46
0
        return;
47
0
    }
48
155k
    o->refcnt++;
49
#if REFCNT_DEBUG
50
    outprintf(ctx->memory, "Incrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
51
#endif
52
155k
}
pdf_doc.c:pdfi_countup_impl
Line
Count
Source
39
73.8k
{
40
73.8k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
41
0
    {
42
#if REFCNT_DEBUG
43
        if (o == NULL)
44
            dprintf("Incrementing reference count of NULL pointer\n");
45
#endif
46
0
        return;
47
0
    }
48
73.8k
    o->refcnt++;
49
#if REFCNT_DEBUG
50
    outprintf(ctx->memory, "Incrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
51
#endif
52
73.8k
}
pdf_fapi.c:pdfi_countup_impl
Line
Count
Source
39
628k
{
40
628k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
41
0
    {
42
#if REFCNT_DEBUG
43
        if (o == NULL)
44
            dprintf("Incrementing reference count of NULL pointer\n");
45
#endif
46
0
        return;
47
0
    }
48
628k
    o->refcnt++;
49
#if REFCNT_DEBUG
50
    outprintf(ctx->memory, "Incrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
51
#endif
52
628k
}
53
54
static inline void pdfi_countdown_impl(pdf_obj *o)
55
108M
{
56
#if defined(DEBUG) || REFCNT_DEBUG
57
    pdf_context *ctx;
58
#endif
59
60
    /* A 'low' pointer value indicates a type that is not an
61
     * actual object (typically keyword). This includes the
62
     * NULL case. Nothing to free in that case. */
63
108M
    if ((uintptr_t)o < TOKEN__LAST_KEY)
64
24.2M
        return;
65
66
#if defined(DEBUG) || REFCNT_DEBUG
67
    ctx = (pdf_context *)o->ctx;
68
#endif
69
#ifdef DEBUG
70
    if (o->refcnt == 0)
71
        emprintf(OBJ_MEMORY(o), "Decrementing object with refcount at 0!\n");
72
#endif
73
84.3M
    o->refcnt--;
74
#if REFCNT_DEBUG
75
    outprintf(ctx->memory, "Decrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
76
#endif
77
84.3M
    if (o->refcnt != 0)
78
43.7M
        return;
79
#if REFCNT_DEBUG
80
    if (ctx != NULL && ctx->cache_entries != 0) {
81
        pdf_obj_cache_entry *entry = ctx->cache_LRU, *next;
82
83
        while(entry) {
84
            next = entry->next;
85
            if (entry->o->object_num != 0 && entry->o->object_num == o->object_num)
86
                outprintf(ctx->memory, "Freeing object %d, UID %lu, but there is still a cache entry!\n", o->object_num, o->UID);
87
            entry = next;
88
        }
89
    }
90
    outprintf(ctx->memory, "Freeing object %d, UID %lu\n", o->object_num, o->UID);
91
#endif
92
#ifdef DEBUG
93
    if (ctx->xref_table != NULL && o->object_num > 0 &&
94
        o->object_num < ctx->xref_table->xref_size &&
95
        ctx->xref_table->xref[o->object_num].cache != NULL &&
96
        ctx->xref_table->xref[o->object_num].cache->o == o) {
97
        outprintf(ctx->memory, "Freeing object %d while it is still in the object cache!\n", o->object_num);
98
    }
99
#endif
100
40.6M
    pdfi_free_object(o);
101
40.6M
}
zpdfops.c:pdfi_countdown_impl
Line
Count
Source
55
137k
{
56
#if defined(DEBUG) || REFCNT_DEBUG
57
    pdf_context *ctx;
58
#endif
59
60
    /* A 'low' pointer value indicates a type that is not an
61
     * actual object (typically keyword). This includes the
62
     * NULL case. Nothing to free in that case. */
63
137k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
64
27.7k
        return;
65
66
#if defined(DEBUG) || REFCNT_DEBUG
67
    ctx = (pdf_context *)o->ctx;
68
#endif
69
#ifdef DEBUG
70
    if (o->refcnt == 0)
71
        emprintf(OBJ_MEMORY(o), "Decrementing object with refcount at 0!\n");
72
#endif
73
109k
    o->refcnt--;
74
#if REFCNT_DEBUG
75
    outprintf(ctx->memory, "Decrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
76
#endif
77
109k
    if (o->refcnt != 0)
78
103k
        return;
79
#if REFCNT_DEBUG
80
    if (ctx != NULL && ctx->cache_entries != 0) {
81
        pdf_obj_cache_entry *entry = ctx->cache_LRU, *next;
82
83
        while(entry) {
84
            next = entry->next;
85
            if (entry->o->object_num != 0 && entry->o->object_num == o->object_num)
86
                outprintf(ctx->memory, "Freeing object %d, UID %lu, but there is still a cache entry!\n", o->object_num, o->UID);
87
            entry = next;
88
        }
89
    }
90
    outprintf(ctx->memory, "Freeing object %d, UID %lu\n", o->object_num, o->UID);
91
#endif
92
#ifdef DEBUG
93
    if (ctx->xref_table != NULL && o->object_num > 0 &&
94
        o->object_num < ctx->xref_table->xref_size &&
95
        ctx->xref_table->xref[o->object_num].cache != NULL &&
96
        ctx->xref_table->xref[o->object_num].cache->o == o) {
97
        outprintf(ctx->memory, "Freeing object %d while it is still in the object cache!\n", o->object_num);
98
    }
99
#endif
100
6.09k
    pdfi_free_object(o);
101
6.09k
}
ghostpdf.c:pdfi_countdown_impl
Line
Count
Source
55
144k
{
56
#if defined(DEBUG) || REFCNT_DEBUG
57
    pdf_context *ctx;
58
#endif
59
60
    /* A 'low' pointer value indicates a type that is not an
61
     * actual object (typically keyword). This includes the
62
     * NULL case. Nothing to free in that case. */
63
144k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
64
17.5k
        return;
65
66
#if defined(DEBUG) || REFCNT_DEBUG
67
    ctx = (pdf_context *)o->ctx;
68
#endif
69
#ifdef DEBUG
70
    if (o->refcnt == 0)
71
        emprintf(OBJ_MEMORY(o), "Decrementing object with refcount at 0!\n");
72
#endif
73
126k
    o->refcnt--;
74
#if REFCNT_DEBUG
75
    outprintf(ctx->memory, "Decrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
76
#endif
77
126k
    if (o->refcnt != 0)
78
44.1k
        return;
79
#if REFCNT_DEBUG
80
    if (ctx != NULL && ctx->cache_entries != 0) {
81
        pdf_obj_cache_entry *entry = ctx->cache_LRU, *next;
82
83
        while(entry) {
84
            next = entry->next;
85
            if (entry->o->object_num != 0 && entry->o->object_num == o->object_num)
86
                outprintf(ctx->memory, "Freeing object %d, UID %lu, but there is still a cache entry!\n", o->object_num, o->UID);
87
            entry = next;
88
        }
89
    }
90
    outprintf(ctx->memory, "Freeing object %d, UID %lu\n", o->object_num, o->UID);
91
#endif
92
#ifdef DEBUG
93
    if (ctx->xref_table != NULL && o->object_num > 0 &&
94
        o->object_num < ctx->xref_table->xref_size &&
95
        ctx->xref_table->xref[o->object_num].cache != NULL &&
96
        ctx->xref_table->xref[o->object_num].cache->o == o) {
97
        outprintf(ctx->memory, "Freeing object %d while it is still in the object cache!\n", o->object_num);
98
    }
99
#endif
100
82.7k
    pdfi_free_object(o);
101
82.7k
}
pdf_dict.c:pdfi_countdown_impl
Line
Count
Source
55
13.2M
{
56
#if defined(DEBUG) || REFCNT_DEBUG
57
    pdf_context *ctx;
58
#endif
59
60
    /* A 'low' pointer value indicates a type that is not an
61
     * actual object (typically keyword). This includes the
62
     * NULL case. Nothing to free in that case. */
63
13.2M
    if ((uintptr_t)o < TOKEN__LAST_KEY)
64
59.5k
        return;
65
66
#if defined(DEBUG) || REFCNT_DEBUG
67
    ctx = (pdf_context *)o->ctx;
68
#endif
69
#ifdef DEBUG
70
    if (o->refcnt == 0)
71
        emprintf(OBJ_MEMORY(o), "Decrementing object with refcount at 0!\n");
72
#endif
73
13.1M
    o->refcnt--;
74
#if REFCNT_DEBUG
75
    outprintf(ctx->memory, "Decrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
76
#endif
77
13.1M
    if (o->refcnt != 0)
78
750k
        return;
79
#if REFCNT_DEBUG
80
    if (ctx != NULL && ctx->cache_entries != 0) {
81
        pdf_obj_cache_entry *entry = ctx->cache_LRU, *next;
82
83
        while(entry) {
84
            next = entry->next;
85
            if (entry->o->object_num != 0 && entry->o->object_num == o->object_num)
86
                outprintf(ctx->memory, "Freeing object %d, UID %lu, but there is still a cache entry!\n", o->object_num, o->UID);
87
            entry = next;
88
        }
89
    }
90
    outprintf(ctx->memory, "Freeing object %d, UID %lu\n", o->object_num, o->UID);
91
#endif
92
#ifdef DEBUG
93
    if (ctx->xref_table != NULL && o->object_num > 0 &&
94
        o->object_num < ctx->xref_table->xref_size &&
95
        ctx->xref_table->xref[o->object_num].cache != NULL &&
96
        ctx->xref_table->xref[o->object_num].cache->o == o) {
97
        outprintf(ctx->memory, "Freeing object %d while it is still in the object cache!\n", o->object_num);
98
    }
99
#endif
100
12.4M
    pdfi_free_object(o);
101
12.4M
}
pdf_array.c:pdfi_countdown_impl
Line
Count
Source
55
20.7M
{
56
#if defined(DEBUG) || REFCNT_DEBUG
57
    pdf_context *ctx;
58
#endif
59
60
    /* A 'low' pointer value indicates a type that is not an
61
     * actual object (typically keyword). This includes the
62
     * NULL case. Nothing to free in that case. */
63
20.7M
    if ((uintptr_t)o < TOKEN__LAST_KEY)
64
9.28M
        return;
65
66
#if defined(DEBUG) || REFCNT_DEBUG
67
    ctx = (pdf_context *)o->ctx;
68
#endif
69
#ifdef DEBUG
70
    if (o->refcnt == 0)
71
        emprintf(OBJ_MEMORY(o), "Decrementing object with refcount at 0!\n");
72
#endif
73
11.4M
    o->refcnt--;
74
#if REFCNT_DEBUG
75
    outprintf(ctx->memory, "Decrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
76
#endif
77
11.4M
    if (o->refcnt != 0)
78
2.59M
        return;
79
#if REFCNT_DEBUG
80
    if (ctx != NULL && ctx->cache_entries != 0) {
81
        pdf_obj_cache_entry *entry = ctx->cache_LRU, *next;
82
83
        while(entry) {
84
            next = entry->next;
85
            if (entry->o->object_num != 0 && entry->o->object_num == o->object_num)
86
                outprintf(ctx->memory, "Freeing object %d, UID %lu, but there is still a cache entry!\n", o->object_num, o->UID);
87
            entry = next;
88
        }
89
    }
90
    outprintf(ctx->memory, "Freeing object %d, UID %lu\n", o->object_num, o->UID);
91
#endif
92
#ifdef DEBUG
93
    if (ctx->xref_table != NULL && o->object_num > 0 &&
94
        o->object_num < ctx->xref_table->xref_size &&
95
        ctx->xref_table->xref[o->object_num].cache != NULL &&
96
        ctx->xref_table->xref[o->object_num].cache->o == o) {
97
        outprintf(ctx->memory, "Freeing object %d while it is still in the object cache!\n", o->object_num);
98
    }
99
#endif
100
8.84M
    pdfi_free_object(o);
101
8.84M
}
pdf_xref.c:pdfi_countdown_impl
Line
Count
Source
55
6.40k
{
56
#if defined(DEBUG) || REFCNT_DEBUG
57
    pdf_context *ctx;
58
#endif
59
60
    /* A 'low' pointer value indicates a type that is not an
61
     * actual object (typically keyword). This includes the
62
     * NULL case. Nothing to free in that case. */
63
6.40k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
64
993
        return;
65
66
#if defined(DEBUG) || REFCNT_DEBUG
67
    ctx = (pdf_context *)o->ctx;
68
#endif
69
#ifdef DEBUG
70
    if (o->refcnt == 0)
71
        emprintf(OBJ_MEMORY(o), "Decrementing object with refcount at 0!\n");
72
#endif
73
5.41k
    o->refcnt--;
74
#if REFCNT_DEBUG
75
    outprintf(ctx->memory, "Decrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
76
#endif
77
5.41k
    if (o->refcnt != 0)
78
4.23k
        return;
79
#if REFCNT_DEBUG
80
    if (ctx != NULL && ctx->cache_entries != 0) {
81
        pdf_obj_cache_entry *entry = ctx->cache_LRU, *next;
82
83
        while(entry) {
84
            next = entry->next;
85
            if (entry->o->object_num != 0 && entry->o->object_num == o->object_num)
86
                outprintf(ctx->memory, "Freeing object %d, UID %lu, but there is still a cache entry!\n", o->object_num, o->UID);
87
            entry = next;
88
        }
89
    }
90
    outprintf(ctx->memory, "Freeing object %d, UID %lu\n", o->object_num, o->UID);
91
#endif
92
#ifdef DEBUG
93
    if (ctx->xref_table != NULL && o->object_num > 0 &&
94
        o->object_num < ctx->xref_table->xref_size &&
95
        ctx->xref_table->xref[o->object_num].cache != NULL &&
96
        ctx->xref_table->xref[o->object_num].cache->o == o) {
97
        outprintf(ctx->memory, "Freeing object %d while it is still in the object cache!\n", o->object_num);
98
    }
99
#endif
100
1.17k
    pdfi_free_object(o);
101
1.17k
}
pdf_int.c:pdfi_countdown_impl
Line
Count
Source
55
1.16M
{
56
#if defined(DEBUG) || REFCNT_DEBUG
57
    pdf_context *ctx;
58
#endif
59
60
    /* A 'low' pointer value indicates a type that is not an
61
     * actual object (typically keyword). This includes the
62
     * NULL case. Nothing to free in that case. */
63
1.16M
    if ((uintptr_t)o < TOKEN__LAST_KEY)
64
1.15M
        return;
65
66
#if defined(DEBUG) || REFCNT_DEBUG
67
    ctx = (pdf_context *)o->ctx;
68
#endif
69
#ifdef DEBUG
70
    if (o->refcnt == 0)
71
        emprintf(OBJ_MEMORY(o), "Decrementing object with refcount at 0!\n");
72
#endif
73
3.59k
    o->refcnt--;
74
#if REFCNT_DEBUG
75
    outprintf(ctx->memory, "Decrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
76
#endif
77
3.59k
    if (o->refcnt != 0)
78
0
        return;
79
#if REFCNT_DEBUG
80
    if (ctx != NULL && ctx->cache_entries != 0) {
81
        pdf_obj_cache_entry *entry = ctx->cache_LRU, *next;
82
83
        while(entry) {
84
            next = entry->next;
85
            if (entry->o->object_num != 0 && entry->o->object_num == o->object_num)
86
                outprintf(ctx->memory, "Freeing object %d, UID %lu, but there is still a cache entry!\n", o->object_num, o->UID);
87
            entry = next;
88
        }
89
    }
90
    outprintf(ctx->memory, "Freeing object %d, UID %lu\n", o->object_num, o->UID);
91
#endif
92
#ifdef DEBUG
93
    if (ctx->xref_table != NULL && o->object_num > 0 &&
94
        o->object_num < ctx->xref_table->xref_size &&
95
        ctx->xref_table->xref[o->object_num].cache != NULL &&
96
        ctx->xref_table->xref[o->object_num].cache->o == o) {
97
        outprintf(ctx->memory, "Freeing object %d while it is still in the object cache!\n", o->object_num);
98
    }
99
#endif
100
3.59k
    pdfi_free_object(o);
101
3.59k
}
pdf_file.c:pdfi_countdown_impl
Line
Count
Source
55
814k
{
56
#if defined(DEBUG) || REFCNT_DEBUG
57
    pdf_context *ctx;
58
#endif
59
60
    /* A 'low' pointer value indicates a type that is not an
61
     * actual object (typically keyword). This includes the
62
     * NULL case. Nothing to free in that case. */
63
814k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
64
719k
        return;
65
66
#if defined(DEBUG) || REFCNT_DEBUG
67
    ctx = (pdf_context *)o->ctx;
68
#endif
69
#ifdef DEBUG
70
    if (o->refcnt == 0)
71
        emprintf(OBJ_MEMORY(o), "Decrementing object with refcount at 0!\n");
72
#endif
73
94.2k
    o->refcnt--;
74
#if REFCNT_DEBUG
75
    outprintf(ctx->memory, "Decrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
76
#endif
77
94.2k
    if (o->refcnt != 0)
78
94.2k
        return;
79
#if REFCNT_DEBUG
80
    if (ctx != NULL && ctx->cache_entries != 0) {
81
        pdf_obj_cache_entry *entry = ctx->cache_LRU, *next;
82
83
        while(entry) {
84
            next = entry->next;
85
            if (entry->o->object_num != 0 && entry->o->object_num == o->object_num)
86
                outprintf(ctx->memory, "Freeing object %d, UID %lu, but there is still a cache entry!\n", o->object_num, o->UID);
87
            entry = next;
88
        }
89
    }
90
    outprintf(ctx->memory, "Freeing object %d, UID %lu\n", o->object_num, o->UID);
91
#endif
92
#ifdef DEBUG
93
    if (ctx->xref_table != NULL && o->object_num > 0 &&
94
        o->object_num < ctx->xref_table->xref_size &&
95
        ctx->xref_table->xref[o->object_num].cache != NULL &&
96
        ctx->xref_table->xref[o->object_num].cache->o == o) {
97
        outprintf(ctx->memory, "Freeing object %d while it is still in the object cache!\n", o->object_num);
98
    }
99
#endif
100
0
    pdfi_free_object(o);
101
0
}
Unexecuted instantiation: pdf_path.c:pdfi_countdown_impl
pdf_colour.c:pdfi_countdown_impl
Line
Count
Source
55
206k
{
56
#if defined(DEBUG) || REFCNT_DEBUG
57
    pdf_context *ctx;
58
#endif
59
60
    /* A 'low' pointer value indicates a type that is not an
61
     * actual object (typically keyword). This includes the
62
     * NULL case. Nothing to free in that case. */
63
206k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
64
87.0k
        return;
65
66
#if defined(DEBUG) || REFCNT_DEBUG
67
    ctx = (pdf_context *)o->ctx;
68
#endif
69
#ifdef DEBUG
70
    if (o->refcnt == 0)
71
        emprintf(OBJ_MEMORY(o), "Decrementing object with refcount at 0!\n");
72
#endif
73
119k
    o->refcnt--;
74
#if REFCNT_DEBUG
75
    outprintf(ctx->memory, "Decrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
76
#endif
77
119k
    if (o->refcnt != 0)
78
88.1k
        return;
79
#if REFCNT_DEBUG
80
    if (ctx != NULL && ctx->cache_entries != 0) {
81
        pdf_obj_cache_entry *entry = ctx->cache_LRU, *next;
82
83
        while(entry) {
84
            next = entry->next;
85
            if (entry->o->object_num != 0 && entry->o->object_num == o->object_num)
86
                outprintf(ctx->memory, "Freeing object %d, UID %lu, but there is still a cache entry!\n", o->object_num, o->UID);
87
            entry = next;
88
        }
89
    }
90
    outprintf(ctx->memory, "Freeing object %d, UID %lu\n", o->object_num, o->UID);
91
#endif
92
#ifdef DEBUG
93
    if (ctx->xref_table != NULL && o->object_num > 0 &&
94
        o->object_num < ctx->xref_table->xref_size &&
95
        ctx->xref_table->xref[o->object_num].cache != NULL &&
96
        ctx->xref_table->xref[o->object_num].cache->o == o) {
97
        outprintf(ctx->memory, "Freeing object %d while it is still in the object cache!\n", o->object_num);
98
    }
99
#endif
100
31.3k
    pdfi_free_object(o);
101
31.3k
}
pdf_pattern.c:pdfi_countdown_impl
Line
Count
Source
55
15.5k
{
56
#if defined(DEBUG) || REFCNT_DEBUG
57
    pdf_context *ctx;
58
#endif
59
60
    /* A 'low' pointer value indicates a type that is not an
61
     * actual object (typically keyword). This includes the
62
     * NULL case. Nothing to free in that case. */
63
15.5k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
64
5.94k
        return;
65
66
#if defined(DEBUG) || REFCNT_DEBUG
67
    ctx = (pdf_context *)o->ctx;
68
#endif
69
#ifdef DEBUG
70
    if (o->refcnt == 0)
71
        emprintf(OBJ_MEMORY(o), "Decrementing object with refcount at 0!\n");
72
#endif
73
9.60k
    o->refcnt--;
74
#if REFCNT_DEBUG
75
    outprintf(ctx->memory, "Decrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
76
#endif
77
9.60k
    if (o->refcnt != 0)
78
9.60k
        return;
79
#if REFCNT_DEBUG
80
    if (ctx != NULL && ctx->cache_entries != 0) {
81
        pdf_obj_cache_entry *entry = ctx->cache_LRU, *next;
82
83
        while(entry) {
84
            next = entry->next;
85
            if (entry->o->object_num != 0 && entry->o->object_num == o->object_num)
86
                outprintf(ctx->memory, "Freeing object %d, UID %lu, but there is still a cache entry!\n", o->object_num, o->UID);
87
            entry = next;
88
        }
89
    }
90
    outprintf(ctx->memory, "Freeing object %d, UID %lu\n", o->object_num, o->UID);
91
#endif
92
#ifdef DEBUG
93
    if (ctx->xref_table != NULL && o->object_num > 0 &&
94
        o->object_num < ctx->xref_table->xref_size &&
95
        ctx->xref_table->xref[o->object_num].cache != NULL &&
96
        ctx->xref_table->xref[o->object_num].cache->o == o) {
97
        outprintf(ctx->memory, "Freeing object %d while it is still in the object cache!\n", o->object_num);
98
    }
99
#endif
100
0
    pdfi_free_object(o);
101
0
}
pdf_gstate.c:pdfi_countdown_impl
Line
Count
Source
55
5.94M
{
56
#if defined(DEBUG) || REFCNT_DEBUG
57
    pdf_context *ctx;
58
#endif
59
60
    /* A 'low' pointer value indicates a type that is not an
61
     * actual object (typically keyword). This includes the
62
     * NULL case. Nothing to free in that case. */
63
5.94M
    if ((uintptr_t)o < TOKEN__LAST_KEY)
64
2.90M
        return;
65
66
#if defined(DEBUG) || REFCNT_DEBUG
67
    ctx = (pdf_context *)o->ctx;
68
#endif
69
#ifdef DEBUG
70
    if (o->refcnt == 0)
71
        emprintf(OBJ_MEMORY(o), "Decrementing object with refcount at 0!\n");
72
#endif
73
3.03M
    o->refcnt--;
74
#if REFCNT_DEBUG
75
    outprintf(ctx->memory, "Decrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
76
#endif
77
3.03M
    if (o->refcnt != 0)
78
2.92M
        return;
79
#if REFCNT_DEBUG
80
    if (ctx != NULL && ctx->cache_entries != 0) {
81
        pdf_obj_cache_entry *entry = ctx->cache_LRU, *next;
82
83
        while(entry) {
84
            next = entry->next;
85
            if (entry->o->object_num != 0 && entry->o->object_num == o->object_num)
86
                outprintf(ctx->memory, "Freeing object %d, UID %lu, but there is still a cache entry!\n", o->object_num, o->UID);
87
            entry = next;
88
        }
89
    }
90
    outprintf(ctx->memory, "Freeing object %d, UID %lu\n", o->object_num, o->UID);
91
#endif
92
#ifdef DEBUG
93
    if (ctx->xref_table != NULL && o->object_num > 0 &&
94
        o->object_num < ctx->xref_table->xref_size &&
95
        ctx->xref_table->xref[o->object_num].cache != NULL &&
96
        ctx->xref_table->xref[o->object_num].cache->o == o) {
97
        outprintf(ctx->memory, "Freeing object %d while it is still in the object cache!\n", o->object_num);
98
    }
99
#endif
100
107k
    pdfi_free_object(o);
101
107k
}
pdf_stack.c:pdfi_countdown_impl
Line
Count
Source
55
38.6M
{
56
#if defined(DEBUG) || REFCNT_DEBUG
57
    pdf_context *ctx;
58
#endif
59
60
    /* A 'low' pointer value indicates a type that is not an
61
     * actual object (typically keyword). This includes the
62
     * NULL case. Nothing to free in that case. */
63
38.6M
    if ((uintptr_t)o < TOKEN__LAST_KEY)
64
6.74M
        return;
65
66
#if defined(DEBUG) || REFCNT_DEBUG
67
    ctx = (pdf_context *)o->ctx;
68
#endif
69
#ifdef DEBUG
70
    if (o->refcnt == 0)
71
        emprintf(OBJ_MEMORY(o), "Decrementing object with refcount at 0!\n");
72
#endif
73
31.9M
    o->refcnt--;
74
#if REFCNT_DEBUG
75
    outprintf(ctx->memory, "Decrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
76
#endif
77
31.9M
    if (o->refcnt != 0)
78
14.6M
        return;
79
#if REFCNT_DEBUG
80
    if (ctx != NULL && ctx->cache_entries != 0) {
81
        pdf_obj_cache_entry *entry = ctx->cache_LRU, *next;
82
83
        while(entry) {
84
            next = entry->next;
85
            if (entry->o->object_num != 0 && entry->o->object_num == o->object_num)
86
                outprintf(ctx->memory, "Freeing object %d, UID %lu, but there is still a cache entry!\n", o->object_num, o->UID);
87
            entry = next;
88
        }
89
    }
90
    outprintf(ctx->memory, "Freeing object %d, UID %lu\n", o->object_num, o->UID);
91
#endif
92
#ifdef DEBUG
93
    if (ctx->xref_table != NULL && o->object_num > 0 &&
94
        o->object_num < ctx->xref_table->xref_size &&
95
        ctx->xref_table->xref[o->object_num].cache != NULL &&
96
        ctx->xref_table->xref[o->object_num].cache->o == o) {
97
        outprintf(ctx->memory, "Freeing object %d while it is still in the object cache!\n", o->object_num);
98
    }
99
#endif
100
17.3M
    pdfi_free_object(o);
101
17.3M
}
pdf_image.c:pdfi_countdown_impl
Line
Count
Source
55
202k
{
56
#if defined(DEBUG) || REFCNT_DEBUG
57
    pdf_context *ctx;
58
#endif
59
60
    /* A 'low' pointer value indicates a type that is not an
61
     * actual object (typically keyword). This includes the
62
     * NULL case. Nothing to free in that case. */
63
202k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
64
48.0k
        return;
65
66
#if defined(DEBUG) || REFCNT_DEBUG
67
    ctx = (pdf_context *)o->ctx;
68
#endif
69
#ifdef DEBUG
70
    if (o->refcnt == 0)
71
        emprintf(OBJ_MEMORY(o), "Decrementing object with refcount at 0!\n");
72
#endif
73
154k
    o->refcnt--;
74
#if REFCNT_DEBUG
75
    outprintf(ctx->memory, "Decrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
76
#endif
77
154k
    if (o->refcnt != 0)
78
109k
        return;
79
#if REFCNT_DEBUG
80
    if (ctx != NULL && ctx->cache_entries != 0) {
81
        pdf_obj_cache_entry *entry = ctx->cache_LRU, *next;
82
83
        while(entry) {
84
            next = entry->next;
85
            if (entry->o->object_num != 0 && entry->o->object_num == o->object_num)
86
                outprintf(ctx->memory, "Freeing object %d, UID %lu, but there is still a cache entry!\n", o->object_num, o->UID);
87
            entry = next;
88
        }
89
    }
90
    outprintf(ctx->memory, "Freeing object %d, UID %lu\n", o->object_num, o->UID);
91
#endif
92
#ifdef DEBUG
93
    if (ctx->xref_table != NULL && o->object_num > 0 &&
94
        o->object_num < ctx->xref_table->xref_size &&
95
        ctx->xref_table->xref[o->object_num].cache != NULL &&
96
        ctx->xref_table->xref[o->object_num].cache->o == o) {
97
        outprintf(ctx->memory, "Freeing object %d while it is still in the object cache!\n", o->object_num);
98
    }
99
#endif
100
45.2k
    pdfi_free_object(o);
101
45.2k
}
pdf_page.c:pdfi_countdown_impl
Line
Count
Source
55
114k
{
56
#if defined(DEBUG) || REFCNT_DEBUG
57
    pdf_context *ctx;
58
#endif
59
60
    /* A 'low' pointer value indicates a type that is not an
61
     * actual object (typically keyword). This includes the
62
     * NULL case. Nothing to free in that case. */
63
114k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
64
17.3k
        return;
65
66
#if defined(DEBUG) || REFCNT_DEBUG
67
    ctx = (pdf_context *)o->ctx;
68
#endif
69
#ifdef DEBUG
70
    if (o->refcnt == 0)
71
        emprintf(OBJ_MEMORY(o), "Decrementing object with refcount at 0!\n");
72
#endif
73
97.0k
    o->refcnt--;
74
#if REFCNT_DEBUG
75
    outprintf(ctx->memory, "Decrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
76
#endif
77
97.0k
    if (o->refcnt != 0)
78
96.9k
        return;
79
#if REFCNT_DEBUG
80
    if (ctx != NULL && ctx->cache_entries != 0) {
81
        pdf_obj_cache_entry *entry = ctx->cache_LRU, *next;
82
83
        while(entry) {
84
            next = entry->next;
85
            if (entry->o->object_num != 0 && entry->o->object_num == o->object_num)
86
                outprintf(ctx->memory, "Freeing object %d, UID %lu, but there is still a cache entry!\n", o->object_num, o->UID);
87
            entry = next;
88
        }
89
    }
90
    outprintf(ctx->memory, "Freeing object %d, UID %lu\n", o->object_num, o->UID);
91
#endif
92
#ifdef DEBUG
93
    if (ctx->xref_table != NULL && o->object_num > 0 &&
94
        o->object_num < ctx->xref_table->xref_size &&
95
        ctx->xref_table->xref[o->object_num].cache != NULL &&
96
        ctx->xref_table->xref[o->object_num].cache->o == o) {
97
        outprintf(ctx->memory, "Freeing object %d while it is still in the object cache!\n", o->object_num);
98
    }
99
#endif
100
90
    pdfi_free_object(o);
101
90
}
pdf_annot.c:pdfi_countdown_impl
Line
Count
Source
55
158k
{
56
#if defined(DEBUG) || REFCNT_DEBUG
57
    pdf_context *ctx;
58
#endif
59
60
    /* A 'low' pointer value indicates a type that is not an
61
     * actual object (typically keyword). This includes the
62
     * NULL case. Nothing to free in that case. */
63
158k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
64
65.2k
        return;
65
66
#if defined(DEBUG) || REFCNT_DEBUG
67
    ctx = (pdf_context *)o->ctx;
68
#endif
69
#ifdef DEBUG
70
    if (o->refcnt == 0)
71
        emprintf(OBJ_MEMORY(o), "Decrementing object with refcount at 0!\n");
72
#endif
73
92.8k
    o->refcnt--;
74
#if REFCNT_DEBUG
75
    outprintf(ctx->memory, "Decrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
76
#endif
77
92.8k
    if (o->refcnt != 0)
78
92.3k
        return;
79
#if REFCNT_DEBUG
80
    if (ctx != NULL && ctx->cache_entries != 0) {
81
        pdf_obj_cache_entry *entry = ctx->cache_LRU, *next;
82
83
        while(entry) {
84
            next = entry->next;
85
            if (entry->o->object_num != 0 && entry->o->object_num == o->object_num)
86
                outprintf(ctx->memory, "Freeing object %d, UID %lu, but there is still a cache entry!\n", o->object_num, o->UID);
87
            entry = next;
88
        }
89
    }
90
    outprintf(ctx->memory, "Freeing object %d, UID %lu\n", o->object_num, o->UID);
91
#endif
92
#ifdef DEBUG
93
    if (ctx->xref_table != NULL && o->object_num > 0 &&
94
        o->object_num < ctx->xref_table->xref_size &&
95
        ctx->xref_table->xref[o->object_num].cache != NULL &&
96
        ctx->xref_table->xref[o->object_num].cache->o == o) {
97
        outprintf(ctx->memory, "Freeing object %d while it is still in the object cache!\n", o->object_num);
98
    }
99
#endif
100
515
    pdfi_free_object(o);
101
515
}
Unexecuted instantiation: pdf_mark.c:pdfi_countdown_impl
pdf_font.c:pdfi_countdown_impl
Line
Count
Source
55
12.3M
{
56
#if defined(DEBUG) || REFCNT_DEBUG
57
    pdf_context *ctx;
58
#endif
59
60
    /* A 'low' pointer value indicates a type that is not an
61
     * actual object (typically keyword). This includes the
62
     * NULL case. Nothing to free in that case. */
63
12.3M
    if ((uintptr_t)o < TOKEN__LAST_KEY)
64
743k
        return;
65
66
#if defined(DEBUG) || REFCNT_DEBUG
67
    ctx = (pdf_context *)o->ctx;
68
#endif
69
#ifdef DEBUG
70
    if (o->refcnt == 0)
71
        emprintf(OBJ_MEMORY(o), "Decrementing object with refcount at 0!\n");
72
#endif
73
11.5M
    o->refcnt--;
74
#if REFCNT_DEBUG
75
    outprintf(ctx->memory, "Decrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
76
#endif
77
11.5M
    if (o->refcnt != 0)
78
11.1M
        return;
79
#if REFCNT_DEBUG
80
    if (ctx != NULL && ctx->cache_entries != 0) {
81
        pdf_obj_cache_entry *entry = ctx->cache_LRU, *next;
82
83
        while(entry) {
84
            next = entry->next;
85
            if (entry->o->object_num != 0 && entry->o->object_num == o->object_num)
86
                outprintf(ctx->memory, "Freeing object %d, UID %lu, but there is still a cache entry!\n", o->object_num, o->UID);
87
            entry = next;
88
        }
89
    }
90
    outprintf(ctx->memory, "Freeing object %d, UID %lu\n", o->object_num, o->UID);
91
#endif
92
#ifdef DEBUG
93
    if (ctx->xref_table != NULL && o->object_num > 0 &&
94
        o->object_num < ctx->xref_table->xref_size &&
95
        ctx->xref_table->xref[o->object_num].cache != NULL &&
96
        ctx->xref_table->xref[o->object_num].cache->o == o) {
97
        outprintf(ctx->memory, "Freeing object %d while it is still in the object cache!\n", o->object_num);
98
    }
99
#endif
100
392k
    pdfi_free_object(o);
101
392k
}
pdf_font0.c:pdfi_countdown_impl
Line
Count
Source
55
62.3k
{
56
#if defined(DEBUG) || REFCNT_DEBUG
57
    pdf_context *ctx;
58
#endif
59
60
    /* A 'low' pointer value indicates a type that is not an
61
     * actual object (typically keyword). This includes the
62
     * NULL case. Nothing to free in that case. */
63
62.3k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
64
15.9k
        return;
65
66
#if defined(DEBUG) || REFCNT_DEBUG
67
    ctx = (pdf_context *)o->ctx;
68
#endif
69
#ifdef DEBUG
70
    if (o->refcnt == 0)
71
        emprintf(OBJ_MEMORY(o), "Decrementing object with refcount at 0!\n");
72
#endif
73
46.4k
    o->refcnt--;
74
#if REFCNT_DEBUG
75
    outprintf(ctx->memory, "Decrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
76
#endif
77
46.4k
    if (o->refcnt != 0)
78
39.5k
        return;
79
#if REFCNT_DEBUG
80
    if (ctx != NULL && ctx->cache_entries != 0) {
81
        pdf_obj_cache_entry *entry = ctx->cache_LRU, *next;
82
83
        while(entry) {
84
            next = entry->next;
85
            if (entry->o->object_num != 0 && entry->o->object_num == o->object_num)
86
                outprintf(ctx->memory, "Freeing object %d, UID %lu, but there is still a cache entry!\n", o->object_num, o->UID);
87
            entry = next;
88
        }
89
    }
90
    outprintf(ctx->memory, "Freeing object %d, UID %lu\n", o->object_num, o->UID);
91
#endif
92
#ifdef DEBUG
93
    if (ctx->xref_table != NULL && o->object_num > 0 &&
94
        o->object_num < ctx->xref_table->xref_size &&
95
        ctx->xref_table->xref[o->object_num].cache != NULL &&
96
        ctx->xref_table->xref[o->object_num].cache->o == o) {
97
        outprintf(ctx->memory, "Freeing object %d while it is still in the object cache!\n", o->object_num);
98
    }
99
#endif
100
6.88k
    pdfi_free_object(o);
101
6.88k
}
pdf_font1.c:pdfi_countdown_impl
Line
Count
Source
55
966k
{
56
#if defined(DEBUG) || REFCNT_DEBUG
57
    pdf_context *ctx;
58
#endif
59
60
    /* A 'low' pointer value indicates a type that is not an
61
     * actual object (typically keyword). This includes the
62
     * NULL case. Nothing to free in that case. */
63
966k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
64
498k
        return;
65
66
#if defined(DEBUG) || REFCNT_DEBUG
67
    ctx = (pdf_context *)o->ctx;
68
#endif
69
#ifdef DEBUG
70
    if (o->refcnt == 0)
71
        emprintf(OBJ_MEMORY(o), "Decrementing object with refcount at 0!\n");
72
#endif
73
468k
    o->refcnt--;
74
#if REFCNT_DEBUG
75
    outprintf(ctx->memory, "Decrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
76
#endif
77
468k
    if (o->refcnt != 0)
78
331k
        return;
79
#if REFCNT_DEBUG
80
    if (ctx != NULL && ctx->cache_entries != 0) {
81
        pdf_obj_cache_entry *entry = ctx->cache_LRU, *next;
82
83
        while(entry) {
84
            next = entry->next;
85
            if (entry->o->object_num != 0 && entry->o->object_num == o->object_num)
86
                outprintf(ctx->memory, "Freeing object %d, UID %lu, but there is still a cache entry!\n", o->object_num, o->UID);
87
            entry = next;
88
        }
89
    }
90
    outprintf(ctx->memory, "Freeing object %d, UID %lu\n", o->object_num, o->UID);
91
#endif
92
#ifdef DEBUG
93
    if (ctx->xref_table != NULL && o->object_num > 0 &&
94
        o->object_num < ctx->xref_table->xref_size &&
95
        ctx->xref_table->xref[o->object_num].cache != NULL &&
96
        ctx->xref_table->xref[o->object_num].cache->o == o) {
97
        outprintf(ctx->memory, "Freeing object %d while it is still in the object cache!\n", o->object_num);
98
    }
99
#endif
100
136k
    pdfi_free_object(o);
101
136k
}
pdf_font1C.c:pdfi_countdown_impl
Line
Count
Source
55
216k
{
56
#if defined(DEBUG) || REFCNT_DEBUG
57
    pdf_context *ctx;
58
#endif
59
60
    /* A 'low' pointer value indicates a type that is not an
61
     * actual object (typically keyword). This includes the
62
     * NULL case. Nothing to free in that case. */
63
216k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
64
40.8k
        return;
65
66
#if defined(DEBUG) || REFCNT_DEBUG
67
    ctx = (pdf_context *)o->ctx;
68
#endif
69
#ifdef DEBUG
70
    if (o->refcnt == 0)
71
        emprintf(OBJ_MEMORY(o), "Decrementing object with refcount at 0!\n");
72
#endif
73
175k
    o->refcnt--;
74
#if REFCNT_DEBUG
75
    outprintf(ctx->memory, "Decrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
76
#endif
77
175k
    if (o->refcnt != 0)
78
112k
        return;
79
#if REFCNT_DEBUG
80
    if (ctx != NULL && ctx->cache_entries != 0) {
81
        pdf_obj_cache_entry *entry = ctx->cache_LRU, *next;
82
83
        while(entry) {
84
            next = entry->next;
85
            if (entry->o->object_num != 0 && entry->o->object_num == o->object_num)
86
                outprintf(ctx->memory, "Freeing object %d, UID %lu, but there is still a cache entry!\n", o->object_num, o->UID);
87
            entry = next;
88
        }
89
    }
90
    outprintf(ctx->memory, "Freeing object %d, UID %lu\n", o->object_num, o->UID);
91
#endif
92
#ifdef DEBUG
93
    if (ctx->xref_table != NULL && o->object_num > 0 &&
94
        o->object_num < ctx->xref_table->xref_size &&
95
        ctx->xref_table->xref[o->object_num].cache != NULL &&
96
        ctx->xref_table->xref[o->object_num].cache->o == o) {
97
        outprintf(ctx->memory, "Freeing object %d while it is still in the object cache!\n", o->object_num);
98
    }
99
#endif
100
62.7k
    pdfi_free_object(o);
101
62.7k
}
pdf_fontps.c:pdfi_countdown_impl
Line
Count
Source
55
4.75M
{
56
#if defined(DEBUG) || REFCNT_DEBUG
57
    pdf_context *ctx;
58
#endif
59
60
    /* A 'low' pointer value indicates a type that is not an
61
     * actual object (typically keyword). This includes the
62
     * NULL case. Nothing to free in that case. */
63
4.75M
    if ((uintptr_t)o < TOKEN__LAST_KEY)
64
21.2k
        return;
65
66
#if defined(DEBUG) || REFCNT_DEBUG
67
    ctx = (pdf_context *)o->ctx;
68
#endif
69
#ifdef DEBUG
70
    if (o->refcnt == 0)
71
        emprintf(OBJ_MEMORY(o), "Decrementing object with refcount at 0!\n");
72
#endif
73
4.73M
    o->refcnt--;
74
#if REFCNT_DEBUG
75
    outprintf(ctx->memory, "Decrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
76
#endif
77
4.73M
    if (o->refcnt != 0)
78
4.72M
        return;
79
#if REFCNT_DEBUG
80
    if (ctx != NULL && ctx->cache_entries != 0) {
81
        pdf_obj_cache_entry *entry = ctx->cache_LRU, *next;
82
83
        while(entry) {
84
            next = entry->next;
85
            if (entry->o->object_num != 0 && entry->o->object_num == o->object_num)
86
                outprintf(ctx->memory, "Freeing object %d, UID %lu, but there is still a cache entry!\n", o->object_num, o->UID);
87
            entry = next;
88
        }
89
    }
90
    outprintf(ctx->memory, "Freeing object %d, UID %lu\n", o->object_num, o->UID);
91
#endif
92
#ifdef DEBUG
93
    if (ctx->xref_table != NULL && o->object_num > 0 &&
94
        o->object_num < ctx->xref_table->xref_size &&
95
        ctx->xref_table->xref[o->object_num].cache != NULL &&
96
        ctx->xref_table->xref[o->object_num].cache->o == o) {
97
        outprintf(ctx->memory, "Freeing object %d while it is still in the object cache!\n", o->object_num);
98
    }
99
#endif
100
3.21k
    pdfi_free_object(o);
101
3.21k
}
pdf_font3.c:pdfi_countdown_impl
Line
Count
Source
55
7.70k
{
56
#if defined(DEBUG) || REFCNT_DEBUG
57
    pdf_context *ctx;
58
#endif
59
60
    /* A 'low' pointer value indicates a type that is not an
61
     * actual object (typically keyword). This includes the
62
     * NULL case. Nothing to free in that case. */
63
7.70k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
64
1.92k
        return;
65
66
#if defined(DEBUG) || REFCNT_DEBUG
67
    ctx = (pdf_context *)o->ctx;
68
#endif
69
#ifdef DEBUG
70
    if (o->refcnt == 0)
71
        emprintf(OBJ_MEMORY(o), "Decrementing object with refcount at 0!\n");
72
#endif
73
5.78k
    o->refcnt--;
74
#if REFCNT_DEBUG
75
    outprintf(ctx->memory, "Decrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
76
#endif
77
5.78k
    if (o->refcnt != 0)
78
5.26k
        return;
79
#if REFCNT_DEBUG
80
    if (ctx != NULL && ctx->cache_entries != 0) {
81
        pdf_obj_cache_entry *entry = ctx->cache_LRU, *next;
82
83
        while(entry) {
84
            next = entry->next;
85
            if (entry->o->object_num != 0 && entry->o->object_num == o->object_num)
86
                outprintf(ctx->memory, "Freeing object %d, UID %lu, but there is still a cache entry!\n", o->object_num, o->UID);
87
            entry = next;
88
        }
89
    }
90
    outprintf(ctx->memory, "Freeing object %d, UID %lu\n", o->object_num, o->UID);
91
#endif
92
#ifdef DEBUG
93
    if (ctx->xref_table != NULL && o->object_num > 0 &&
94
        o->object_num < ctx->xref_table->xref_size &&
95
        ctx->xref_table->xref[o->object_num].cache != NULL &&
96
        ctx->xref_table->xref[o->object_num].cache->o == o) {
97
        outprintf(ctx->memory, "Freeing object %d while it is still in the object cache!\n", o->object_num);
98
    }
99
#endif
100
521
    pdfi_free_object(o);
101
521
}
pdf_fontTT.c:pdfi_countdown_impl
Line
Count
Source
55
347k
{
56
#if defined(DEBUG) || REFCNT_DEBUG
57
    pdf_context *ctx;
58
#endif
59
60
    /* A 'low' pointer value indicates a type that is not an
61
     * actual object (typically keyword). This includes the
62
     * NULL case. Nothing to free in that case. */
63
347k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
64
14.9k
        return;
65
66
#if defined(DEBUG) || REFCNT_DEBUG
67
    ctx = (pdf_context *)o->ctx;
68
#endif
69
#ifdef DEBUG
70
    if (o->refcnt == 0)
71
        emprintf(OBJ_MEMORY(o), "Decrementing object with refcount at 0!\n");
72
#endif
73
332k
    o->refcnt--;
74
#if REFCNT_DEBUG
75
    outprintf(ctx->memory, "Decrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
76
#endif
77
332k
    if (o->refcnt != 0)
78
315k
        return;
79
#if REFCNT_DEBUG
80
    if (ctx != NULL && ctx->cache_entries != 0) {
81
        pdf_obj_cache_entry *entry = ctx->cache_LRU, *next;
82
83
        while(entry) {
84
            next = entry->next;
85
            if (entry->o->object_num != 0 && entry->o->object_num == o->object_num)
86
                outprintf(ctx->memory, "Freeing object %d, UID %lu, but there is still a cache entry!\n", o->object_num, o->UID);
87
            entry = next;
88
        }
89
    }
90
    outprintf(ctx->memory, "Freeing object %d, UID %lu\n", o->object_num, o->UID);
91
#endif
92
#ifdef DEBUG
93
    if (ctx->xref_table != NULL && o->object_num > 0 &&
94
        o->object_num < ctx->xref_table->xref_size &&
95
        ctx->xref_table->xref[o->object_num].cache != NULL &&
96
        ctx->xref_table->xref[o->object_num].cache->o == o) {
97
        outprintf(ctx->memory, "Freeing object %d while it is still in the object cache!\n", o->object_num);
98
    }
99
#endif
100
16.8k
    pdfi_free_object(o);
101
16.8k
}
pdf_font11.c:pdfi_countdown_impl
Line
Count
Source
55
24.0k
{
56
#if defined(DEBUG) || REFCNT_DEBUG
57
    pdf_context *ctx;
58
#endif
59
60
    /* A 'low' pointer value indicates a type that is not an
61
     * actual object (typically keyword). This includes the
62
     * NULL case. Nothing to free in that case. */
63
24.0k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
64
11.8k
        return;
65
66
#if defined(DEBUG) || REFCNT_DEBUG
67
    ctx = (pdf_context *)o->ctx;
68
#endif
69
#ifdef DEBUG
70
    if (o->refcnt == 0)
71
        emprintf(OBJ_MEMORY(o), "Decrementing object with refcount at 0!\n");
72
#endif
73
12.2k
    o->refcnt--;
74
#if REFCNT_DEBUG
75
    outprintf(ctx->memory, "Decrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
76
#endif
77
12.2k
    if (o->refcnt != 0)
78
5.59k
        return;
79
#if REFCNT_DEBUG
80
    if (ctx != NULL && ctx->cache_entries != 0) {
81
        pdf_obj_cache_entry *entry = ctx->cache_LRU, *next;
82
83
        while(entry) {
84
            next = entry->next;
85
            if (entry->o->object_num != 0 && entry->o->object_num == o->object_num)
86
                outprintf(ctx->memory, "Freeing object %d, UID %lu, but there is still a cache entry!\n", o->object_num, o->UID);
87
            entry = next;
88
        }
89
    }
90
    outprintf(ctx->memory, "Freeing object %d, UID %lu\n", o->object_num, o->UID);
91
#endif
92
#ifdef DEBUG
93
    if (ctx->xref_table != NULL && o->object_num > 0 &&
94
        o->object_num < ctx->xref_table->xref_size &&
95
        ctx->xref_table->xref[o->object_num].cache != NULL &&
96
        ctx->xref_table->xref[o->object_num].cache->o == o) {
97
        outprintf(ctx->memory, "Freeing object %d while it is still in the object cache!\n", o->object_num);
98
    }
99
#endif
100
6.63k
    pdfi_free_object(o);
101
6.63k
}
pdf_cmap.c:pdfi_countdown_impl
Line
Count
Source
55
4.86k
{
56
#if defined(DEBUG) || REFCNT_DEBUG
57
    pdf_context *ctx;
58
#endif
59
60
    /* A 'low' pointer value indicates a type that is not an
61
     * actual object (typically keyword). This includes the
62
     * NULL case. Nothing to free in that case. */
63
4.86k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
64
4.82k
        return;
65
66
#if defined(DEBUG) || REFCNT_DEBUG
67
    ctx = (pdf_context *)o->ctx;
68
#endif
69
#ifdef DEBUG
70
    if (o->refcnt == 0)
71
        emprintf(OBJ_MEMORY(o), "Decrementing object with refcount at 0!\n");
72
#endif
73
46
    o->refcnt--;
74
#if REFCNT_DEBUG
75
    outprintf(ctx->memory, "Decrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
76
#endif
77
46
    if (o->refcnt != 0)
78
15
        return;
79
#if REFCNT_DEBUG
80
    if (ctx != NULL && ctx->cache_entries != 0) {
81
        pdf_obj_cache_entry *entry = ctx->cache_LRU, *next;
82
83
        while(entry) {
84
            next = entry->next;
85
            if (entry->o->object_num != 0 && entry->o->object_num == o->object_num)
86
                outprintf(ctx->memory, "Freeing object %d, UID %lu, but there is still a cache entry!\n", o->object_num, o->UID);
87
            entry = next;
88
        }
89
    }
90
    outprintf(ctx->memory, "Freeing object %d, UID %lu\n", o->object_num, o->UID);
91
#endif
92
#ifdef DEBUG
93
    if (ctx->xref_table != NULL && o->object_num > 0 &&
94
        o->object_num < ctx->xref_table->xref_size &&
95
        ctx->xref_table->xref[o->object_num].cache != NULL &&
96
        ctx->xref_table->xref[o->object_num].cache->o == o) {
97
        outprintf(ctx->memory, "Freeing object %d while it is still in the object cache!\n", o->object_num);
98
    }
99
#endif
100
31
    pdfi_free_object(o);
101
31
}
pdf_fmap.c:pdfi_countdown_impl
Line
Count
Source
55
163k
{
56
#if defined(DEBUG) || REFCNT_DEBUG
57
    pdf_context *ctx;
58
#endif
59
60
    /* A 'low' pointer value indicates a type that is not an
61
     * actual object (typically keyword). This includes the
62
     * NULL case. Nothing to free in that case. */
63
163k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
64
157k
        return;
65
66
#if defined(DEBUG) || REFCNT_DEBUG
67
    ctx = (pdf_context *)o->ctx;
68
#endif
69
#ifdef DEBUG
70
    if (o->refcnt == 0)
71
        emprintf(OBJ_MEMORY(o), "Decrementing object with refcount at 0!\n");
72
#endif
73
5.33k
    o->refcnt--;
74
#if REFCNT_DEBUG
75
    outprintf(ctx->memory, "Decrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
76
#endif
77
5.33k
    if (o->refcnt != 0)
78
5.33k
        return;
79
#if REFCNT_DEBUG
80
    if (ctx != NULL && ctx->cache_entries != 0) {
81
        pdf_obj_cache_entry *entry = ctx->cache_LRU, *next;
82
83
        while(entry) {
84
            next = entry->next;
85
            if (entry->o->object_num != 0 && entry->o->object_num == o->object_num)
86
                outprintf(ctx->memory, "Freeing object %d, UID %lu, but there is still a cache entry!\n", o->object_num, o->UID);
87
            entry = next;
88
        }
89
    }
90
    outprintf(ctx->memory, "Freeing object %d, UID %lu\n", o->object_num, o->UID);
91
#endif
92
#ifdef DEBUG
93
    if (ctx->xref_table != NULL && o->object_num > 0 &&
94
        o->object_num < ctx->xref_table->xref_size &&
95
        ctx->xref_table->xref[o->object_num].cache != NULL &&
96
        ctx->xref_table->xref[o->object_num].cache->o == o) {
97
        outprintf(ctx->memory, "Freeing object %d while it is still in the object cache!\n", o->object_num);
98
    }
99
#endif
100
0
    pdfi_free_object(o);
101
0
}
pdf_text.c:pdfi_countdown_impl
Line
Count
Source
55
2.54M
{
56
#if defined(DEBUG) || REFCNT_DEBUG
57
    pdf_context *ctx;
58
#endif
59
60
    /* A 'low' pointer value indicates a type that is not an
61
     * actual object (typically keyword). This includes the
62
     * NULL case. Nothing to free in that case. */
63
2.54M
    if ((uintptr_t)o < TOKEN__LAST_KEY)
64
156k
        return;
65
66
#if defined(DEBUG) || REFCNT_DEBUG
67
    ctx = (pdf_context *)o->ctx;
68
#endif
69
#ifdef DEBUG
70
    if (o->refcnt == 0)
71
        emprintf(OBJ_MEMORY(o), "Decrementing object with refcount at 0!\n");
72
#endif
73
2.38M
    o->refcnt--;
74
#if REFCNT_DEBUG
75
    outprintf(ctx->memory, "Decrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
76
#endif
77
2.38M
    if (o->refcnt != 0)
78
2.06M
        return;
79
#if REFCNT_DEBUG
80
    if (ctx != NULL && ctx->cache_entries != 0) {
81
        pdf_obj_cache_entry *entry = ctx->cache_LRU, *next;
82
83
        while(entry) {
84
            next = entry->next;
85
            if (entry->o->object_num != 0 && entry->o->object_num == o->object_num)
86
                outprintf(ctx->memory, "Freeing object %d, UID %lu, but there is still a cache entry!\n", o->object_num, o->UID);
87
            entry = next;
88
        }
89
    }
90
    outprintf(ctx->memory, "Freeing object %d, UID %lu\n", o->object_num, o->UID);
91
#endif
92
#ifdef DEBUG
93
    if (ctx->xref_table != NULL && o->object_num > 0 &&
94
        o->object_num < ctx->xref_table->xref_size &&
95
        ctx->xref_table->xref[o->object_num].cache != NULL &&
96
        ctx->xref_table->xref[o->object_num].cache->o == o) {
97
        outprintf(ctx->memory, "Freeing object %d while it is still in the object cache!\n", o->object_num);
98
    }
99
#endif
100
318k
    pdfi_free_object(o);
101
318k
}
pdf_shading.c:pdfi_countdown_impl
Line
Count
Source
55
39.0k
{
56
#if defined(DEBUG) || REFCNT_DEBUG
57
    pdf_context *ctx;
58
#endif
59
60
    /* A 'low' pointer value indicates a type that is not an
61
     * actual object (typically keyword). This includes the
62
     * NULL case. Nothing to free in that case. */
63
39.0k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
64
11.1k
        return;
65
66
#if defined(DEBUG) || REFCNT_DEBUG
67
    ctx = (pdf_context *)o->ctx;
68
#endif
69
#ifdef DEBUG
70
    if (o->refcnt == 0)
71
        emprintf(OBJ_MEMORY(o), "Decrementing object with refcount at 0!\n");
72
#endif
73
27.8k
    o->refcnt--;
74
#if REFCNT_DEBUG
75
    outprintf(ctx->memory, "Decrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
76
#endif
77
27.8k
    if (o->refcnt != 0)
78
16.9k
        return;
79
#if REFCNT_DEBUG
80
    if (ctx != NULL && ctx->cache_entries != 0) {
81
        pdf_obj_cache_entry *entry = ctx->cache_LRU, *next;
82
83
        while(entry) {
84
            next = entry->next;
85
            if (entry->o->object_num != 0 && entry->o->object_num == o->object_num)
86
                outprintf(ctx->memory, "Freeing object %d, UID %lu, but there is still a cache entry!\n", o->object_num, o->UID);
87
            entry = next;
88
        }
89
    }
90
    outprintf(ctx->memory, "Freeing object %d, UID %lu\n", o->object_num, o->UID);
91
#endif
92
#ifdef DEBUG
93
    if (ctx->xref_table != NULL && o->object_num > 0 &&
94
        o->object_num < ctx->xref_table->xref_size &&
95
        ctx->xref_table->xref[o->object_num].cache != NULL &&
96
        ctx->xref_table->xref[o->object_num].cache->o == o) {
97
        outprintf(ctx->memory, "Freeing object %d while it is still in the object cache!\n", o->object_num);
98
    }
99
#endif
100
10.9k
    pdfi_free_object(o);
101
10.9k
}
pdf_func.c:pdfi_countdown_impl
Line
Count
Source
55
9.11k
{
56
#if defined(DEBUG) || REFCNT_DEBUG
57
    pdf_context *ctx;
58
#endif
59
60
    /* A 'low' pointer value indicates a type that is not an
61
     * actual object (typically keyword). This includes the
62
     * NULL case. Nothing to free in that case. */
63
9.11k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
64
0
        return;
65
66
#if defined(DEBUG) || REFCNT_DEBUG
67
    ctx = (pdf_context *)o->ctx;
68
#endif
69
#ifdef DEBUG
70
    if (o->refcnt == 0)
71
        emprintf(OBJ_MEMORY(o), "Decrementing object with refcount at 0!\n");
72
#endif
73
9.11k
    o->refcnt--;
74
#if REFCNT_DEBUG
75
    outprintf(ctx->memory, "Decrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
76
#endif
77
9.11k
    if (o->refcnt != 0)
78
9.11k
        return;
79
#if REFCNT_DEBUG
80
    if (ctx != NULL && ctx->cache_entries != 0) {
81
        pdf_obj_cache_entry *entry = ctx->cache_LRU, *next;
82
83
        while(entry) {
84
            next = entry->next;
85
            if (entry->o->object_num != 0 && entry->o->object_num == o->object_num)
86
                outprintf(ctx->memory, "Freeing object %d, UID %lu, but there is still a cache entry!\n", o->object_num, o->UID);
87
            entry = next;
88
        }
89
    }
90
    outprintf(ctx->memory, "Freeing object %d, UID %lu\n", o->object_num, o->UID);
91
#endif
92
#ifdef DEBUG
93
    if (ctx->xref_table != NULL && o->object_num > 0 &&
94
        o->object_num < ctx->xref_table->xref_size &&
95
        ctx->xref_table->xref[o->object_num].cache != NULL &&
96
        ctx->xref_table->xref[o->object_num].cache->o == o) {
97
        outprintf(ctx->memory, "Freeing object %d while it is still in the object cache!\n", o->object_num);
98
    }
99
#endif
100
0
    pdfi_free_object(o);
101
0
}
pdf_trans.c:pdfi_countdown_impl
Line
Count
Source
55
13.4k
{
56
#if defined(DEBUG) || REFCNT_DEBUG
57
    pdf_context *ctx;
58
#endif
59
60
    /* A 'low' pointer value indicates a type that is not an
61
     * actual object (typically keyword). This includes the
62
     * NULL case. Nothing to free in that case. */
63
13.4k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
64
7.38k
        return;
65
66
#if defined(DEBUG) || REFCNT_DEBUG
67
    ctx = (pdf_context *)o->ctx;
68
#endif
69
#ifdef DEBUG
70
    if (o->refcnt == 0)
71
        emprintf(OBJ_MEMORY(o), "Decrementing object with refcount at 0!\n");
72
#endif
73
6.09k
    o->refcnt--;
74
#if REFCNT_DEBUG
75
    outprintf(ctx->memory, "Decrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
76
#endif
77
6.09k
    if (o->refcnt != 0)
78
6.09k
        return;
79
#if REFCNT_DEBUG
80
    if (ctx != NULL && ctx->cache_entries != 0) {
81
        pdf_obj_cache_entry *entry = ctx->cache_LRU, *next;
82
83
        while(entry) {
84
            next = entry->next;
85
            if (entry->o->object_num != 0 && entry->o->object_num == o->object_num)
86
                outprintf(ctx->memory, "Freeing object %d, UID %lu, but there is still a cache entry!\n", o->object_num, o->UID);
87
            entry = next;
88
        }
89
    }
90
    outprintf(ctx->memory, "Freeing object %d, UID %lu\n", o->object_num, o->UID);
91
#endif
92
#ifdef DEBUG
93
    if (ctx->xref_table != NULL && o->object_num > 0 &&
94
        o->object_num < ctx->xref_table->xref_size &&
95
        ctx->xref_table->xref[o->object_num].cache != NULL &&
96
        ctx->xref_table->xref[o->object_num].cache->o == o) {
97
        outprintf(ctx->memory, "Freeing object %d while it is still in the object cache!\n", o->object_num);
98
    }
99
#endif
100
0
    pdfi_free_object(o);
101
0
}
Unexecuted instantiation: pdf_device.c:pdfi_countdown_impl
Unexecuted instantiation: pdf_misc.c:pdfi_countdown_impl
pdf_optcontent.c:pdfi_countdown_impl
Line
Count
Source
55
189k
{
56
#if defined(DEBUG) || REFCNT_DEBUG
57
    pdf_context *ctx;
58
#endif
59
60
    /* A 'low' pointer value indicates a type that is not an
61
     * actual object (typically keyword). This includes the
62
     * NULL case. Nothing to free in that case. */
63
189k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
64
97.6k
        return;
65
66
#if defined(DEBUG) || REFCNT_DEBUG
67
    ctx = (pdf_context *)o->ctx;
68
#endif
69
#ifdef DEBUG
70
    if (o->refcnt == 0)
71
        emprintf(OBJ_MEMORY(o), "Decrementing object with refcount at 0!\n");
72
#endif
73
91.9k
    o->refcnt--;
74
#if REFCNT_DEBUG
75
    outprintf(ctx->memory, "Decrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
76
#endif
77
91.9k
    if (o->refcnt != 0)
78
21.9k
        return;
79
#if REFCNT_DEBUG
80
    if (ctx != NULL && ctx->cache_entries != 0) {
81
        pdf_obj_cache_entry *entry = ctx->cache_LRU, *next;
82
83
        while(entry) {
84
            next = entry->next;
85
            if (entry->o->object_num != 0 && entry->o->object_num == o->object_num)
86
                outprintf(ctx->memory, "Freeing object %d, UID %lu, but there is still a cache entry!\n", o->object_num, o->UID);
87
            entry = next;
88
        }
89
    }
90
    outprintf(ctx->memory, "Freeing object %d, UID %lu\n", o->object_num, o->UID);
91
#endif
92
#ifdef DEBUG
93
    if (ctx->xref_table != NULL && o->object_num > 0 &&
94
        o->object_num < ctx->xref_table->xref_size &&
95
        ctx->xref_table->xref[o->object_num].cache != NULL &&
96
        ctx->xref_table->xref[o->object_num].cache->o == o) {
97
        outprintf(ctx->memory, "Freeing object %d while it is still in the object cache!\n", o->object_num);
98
    }
99
#endif
100
70.0k
    pdfi_free_object(o);
101
70.0k
}
pdf_check.c:pdfi_countdown_impl
Line
Count
Source
55
522k
{
56
#if defined(DEBUG) || REFCNT_DEBUG
57
    pdf_context *ctx;
58
#endif
59
60
    /* A 'low' pointer value indicates a type that is not an
61
     * actual object (typically keyword). This includes the
62
     * NULL case. Nothing to free in that case. */
63
522k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
64
246k
        return;
65
66
#if defined(DEBUG) || REFCNT_DEBUG
67
    ctx = (pdf_context *)o->ctx;
68
#endif
69
#ifdef DEBUG
70
    if (o->refcnt == 0)
71
        emprintf(OBJ_MEMORY(o), "Decrementing object with refcount at 0!\n");
72
#endif
73
275k
    o->refcnt--;
74
#if REFCNT_DEBUG
75
    outprintf(ctx->memory, "Decrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
76
#endif
77
275k
    if (o->refcnt != 0)
78
275k
        return;
79
#if REFCNT_DEBUG
80
    if (ctx != NULL && ctx->cache_entries != 0) {
81
        pdf_obj_cache_entry *entry = ctx->cache_LRU, *next;
82
83
        while(entry) {
84
            next = entry->next;
85
            if (entry->o->object_num != 0 && entry->o->object_num == o->object_num)
86
                outprintf(ctx->memory, "Freeing object %d, UID %lu, but there is still a cache entry!\n", o->object_num, o->UID);
87
            entry = next;
88
        }
89
    }
90
    outprintf(ctx->memory, "Freeing object %d, UID %lu\n", o->object_num, o->UID);
91
#endif
92
#ifdef DEBUG
93
    if (ctx->xref_table != NULL && o->object_num > 0 &&
94
        o->object_num < ctx->xref_table->xref_size &&
95
        ctx->xref_table->xref[o->object_num].cache != NULL &&
96
        ctx->xref_table->xref[o->object_num].cache->o == o) {
97
        outprintf(ctx->memory, "Freeing object %d while it is still in the object cache!\n", o->object_num);
98
    }
99
#endif
100
0
    pdfi_free_object(o);
101
0
}
pdf_sec.c:pdfi_countdown_impl
Line
Count
Source
55
2.99k
{
56
#if defined(DEBUG) || REFCNT_DEBUG
57
    pdf_context *ctx;
58
#endif
59
60
    /* A 'low' pointer value indicates a type that is not an
61
     * actual object (typically keyword). This includes the
62
     * NULL case. Nothing to free in that case. */
63
2.99k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
64
285
        return;
65
66
#if defined(DEBUG) || REFCNT_DEBUG
67
    ctx = (pdf_context *)o->ctx;
68
#endif
69
#ifdef DEBUG
70
    if (o->refcnt == 0)
71
        emprintf(OBJ_MEMORY(o), "Decrementing object with refcount at 0!\n");
72
#endif
73
2.70k
    o->refcnt--;
74
#if REFCNT_DEBUG
75
    outprintf(ctx->memory, "Decrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
76
#endif
77
2.70k
    if (o->refcnt != 0)
78
1.38k
        return;
79
#if REFCNT_DEBUG
80
    if (ctx != NULL && ctx->cache_entries != 0) {
81
        pdf_obj_cache_entry *entry = ctx->cache_LRU, *next;
82
83
        while(entry) {
84
            next = entry->next;
85
            if (entry->o->object_num != 0 && entry->o->object_num == o->object_num)
86
                outprintf(ctx->memory, "Freeing object %d, UID %lu, but there is still a cache entry!\n", o->object_num, o->UID);
87
            entry = next;
88
        }
89
    }
90
    outprintf(ctx->memory, "Freeing object %d, UID %lu\n", o->object_num, o->UID);
91
#endif
92
#ifdef DEBUG
93
    if (ctx->xref_table != NULL && o->object_num > 0 &&
94
        o->object_num < ctx->xref_table->xref_size &&
95
        ctx->xref_table->xref[o->object_num].cache != NULL &&
96
        ctx->xref_table->xref[o->object_num].cache->o == o) {
97
        outprintf(ctx->memory, "Freeing object %d while it is still in the object cache!\n", o->object_num);
98
    }
99
#endif
100
1.32k
    pdfi_free_object(o);
101
1.32k
}
Unexecuted instantiation: pdf_utf8.c:pdfi_countdown_impl
pdf_deref.c:pdfi_countdown_impl
Line
Count
Source
55
145k
{
56
#if defined(DEBUG) || REFCNT_DEBUG
57
    pdf_context *ctx;
58
#endif
59
60
    /* A 'low' pointer value indicates a type that is not an
61
     * actual object (typically keyword). This includes the
62
     * NULL case. Nothing to free in that case. */
63
145k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
64
2.23k
        return;
65
66
#if defined(DEBUG) || REFCNT_DEBUG
67
    ctx = (pdf_context *)o->ctx;
68
#endif
69
#ifdef DEBUG
70
    if (o->refcnt == 0)
71
        emprintf(OBJ_MEMORY(o), "Decrementing object with refcount at 0!\n");
72
#endif
73
143k
    o->refcnt--;
74
#if REFCNT_DEBUG
75
    outprintf(ctx->memory, "Decrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
76
#endif
77
143k
    if (o->refcnt != 0)
78
131k
        return;
79
#if REFCNT_DEBUG
80
    if (ctx != NULL && ctx->cache_entries != 0) {
81
        pdf_obj_cache_entry *entry = ctx->cache_LRU, *next;
82
83
        while(entry) {
84
            next = entry->next;
85
            if (entry->o->object_num != 0 && entry->o->object_num == o->object_num)
86
                outprintf(ctx->memory, "Freeing object %d, UID %lu, but there is still a cache entry!\n", o->object_num, o->UID);
87
            entry = next;
88
        }
89
    }
90
    outprintf(ctx->memory, "Freeing object %d, UID %lu\n", o->object_num, o->UID);
91
#endif
92
#ifdef DEBUG
93
    if (ctx->xref_table != NULL && o->object_num > 0 &&
94
        o->object_num < ctx->xref_table->xref_size &&
95
        ctx->xref_table->xref[o->object_num].cache != NULL &&
96
        ctx->xref_table->xref[o->object_num].cache->o == o) {
97
        outprintf(ctx->memory, "Freeing object %d while it is still in the object cache!\n", o->object_num);
98
    }
99
#endif
100
11.7k
    pdfi_free_object(o);
101
11.7k
}
pdf_repair.c:pdfi_countdown_impl
Line
Count
Source
55
185k
{
56
#if defined(DEBUG) || REFCNT_DEBUG
57
    pdf_context *ctx;
58
#endif
59
60
    /* A 'low' pointer value indicates a type that is not an
61
     * actual object (typically keyword). This includes the
62
     * NULL case. Nothing to free in that case. */
63
185k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
64
86.4k
        return;
65
66
#if defined(DEBUG) || REFCNT_DEBUG
67
    ctx = (pdf_context *)o->ctx;
68
#endif
69
#ifdef DEBUG
70
    if (o->refcnt == 0)
71
        emprintf(OBJ_MEMORY(o), "Decrementing object with refcount at 0!\n");
72
#endif
73
98.8k
    o->refcnt--;
74
#if REFCNT_DEBUG
75
    outprintf(ctx->memory, "Decrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
76
#endif
77
98.8k
    if (o->refcnt != 0)
78
95.3k
        return;
79
#if REFCNT_DEBUG
80
    if (ctx != NULL && ctx->cache_entries != 0) {
81
        pdf_obj_cache_entry *entry = ctx->cache_LRU, *next;
82
83
        while(entry) {
84
            next = entry->next;
85
            if (entry->o->object_num != 0 && entry->o->object_num == o->object_num)
86
                outprintf(ctx->memory, "Freeing object %d, UID %lu, but there is still a cache entry!\n", o->object_num, o->UID);
87
            entry = next;
88
        }
89
    }
90
    outprintf(ctx->memory, "Freeing object %d, UID %lu\n", o->object_num, o->UID);
91
#endif
92
#ifdef DEBUG
93
    if (ctx->xref_table != NULL && o->object_num > 0 &&
94
        o->object_num < ctx->xref_table->xref_size &&
95
        ctx->xref_table->xref[o->object_num].cache != NULL &&
96
        ctx->xref_table->xref[o->object_num].cache->o == o) {
97
        outprintf(ctx->memory, "Freeing object %d while it is still in the object cache!\n", o->object_num);
98
    }
99
#endif
100
3.46k
    pdfi_free_object(o);
101
3.46k
}
pdf_obj.c:pdfi_countdown_impl
Line
Count
Source
55
58.1k
{
56
#if defined(DEBUG) || REFCNT_DEBUG
57
    pdf_context *ctx;
58
#endif
59
60
    /* A 'low' pointer value indicates a type that is not an
61
     * actual object (typically keyword). This includes the
62
     * NULL case. Nothing to free in that case. */
63
58.1k
    if ((uintptr_t)o < TOKEN__LAST_KEY)
64
0
        return;
65
66
#if defined(DEBUG) || REFCNT_DEBUG
67
    ctx = (pdf_context *)o->ctx;
68
#endif
69
#ifdef DEBUG
70
    if (o->refcnt == 0)
71
        emprintf(OBJ_MEMORY(o), "Decrementing object with refcount at 0!\n");
72
#endif
73
58.1k
    o->refcnt--;
74
#if REFCNT_DEBUG
75
    outprintf(ctx->memory, "Decrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
76
#endif
77
58.1k
    if (o->refcnt != 0)
78
19.1k
        return;
79
#if REFCNT_DEBUG
80
    if (ctx != NULL && ctx->cache_entries != 0) {
81
        pdf_obj_cache_entry *entry = ctx->cache_LRU, *next;
82
83
        while(entry) {
84
            next = entry->next;
85
            if (entry->o->object_num != 0 && entry->o->object_num == o->object_num)
86
                outprintf(ctx->memory, "Freeing object %d, UID %lu, but there is still a cache entry!\n", o->object_num, o->UID);
87
            entry = next;
88
        }
89
    }
90
    outprintf(ctx->memory, "Freeing object %d, UID %lu\n", o->object_num, o->UID);
91
#endif
92
#ifdef DEBUG
93
    if (ctx->xref_table != NULL && o->object_num > 0 &&
94
        o->object_num < ctx->xref_table->xref_size &&
95
        ctx->xref_table->xref[o->object_num].cache != NULL &&
96
        ctx->xref_table->xref[o->object_num].cache->o == o) {
97
        outprintf(ctx->memory, "Freeing object %d while it is still in the object cache!\n", o->object_num);
98
    }
99
#endif
100
39.0k
    pdfi_free_object(o);
101
39.0k
}
pdf_doc.c:pdfi_countdown_impl
Line
Count
Source
55
1.70M
{
56
#if defined(DEBUG) || REFCNT_DEBUG
57
    pdf_context *ctx;
58
#endif
59
60
    /* A 'low' pointer value indicates a type that is not an
61
     * actual object (typically keyword). This includes the
62
     * NULL case. Nothing to free in that case. */
63
1.70M
    if ((uintptr_t)o < TOKEN__LAST_KEY)
64
970k
        return;
65
66
#if defined(DEBUG) || REFCNT_DEBUG
67
    ctx = (pdf_context *)o->ctx;
68
#endif
69
#ifdef DEBUG
70
    if (o->refcnt == 0)
71
        emprintf(OBJ_MEMORY(o), "Decrementing object with refcount at 0!\n");
72
#endif
73
735k
    o->refcnt--;
74
#if REFCNT_DEBUG
75
    outprintf(ctx->memory, "Decrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
76
#endif
77
735k
    if (o->refcnt != 0)
78
716k
        return;
79
#if REFCNT_DEBUG
80
    if (ctx != NULL && ctx->cache_entries != 0) {
81
        pdf_obj_cache_entry *entry = ctx->cache_LRU, *next;
82
83
        while(entry) {
84
            next = entry->next;
85
            if (entry->o->object_num != 0 && entry->o->object_num == o->object_num)
86
                outprintf(ctx->memory, "Freeing object %d, UID %lu, but there is still a cache entry!\n", o->object_num, o->UID);
87
            entry = next;
88
        }
89
    }
90
    outprintf(ctx->memory, "Freeing object %d, UID %lu\n", o->object_num, o->UID);
91
#endif
92
#ifdef DEBUG
93
    if (ctx->xref_table != NULL && o->object_num > 0 &&
94
        o->object_num < ctx->xref_table->xref_size &&
95
        ctx->xref_table->xref[o->object_num].cache != NULL &&
96
        ctx->xref_table->xref[o->object_num].cache->o == o) {
97
        outprintf(ctx->memory, "Freeing object %d while it is still in the object cache!\n", o->object_num);
98
    }
99
#endif
100
18.6k
    pdfi_free_object(o);
101
18.6k
}
pdf_fapi.c:pdfi_countdown_impl
Line
Count
Source
55
2.76M
{
56
#if defined(DEBUG) || REFCNT_DEBUG
57
    pdf_context *ctx;
58
#endif
59
60
    /* A 'low' pointer value indicates a type that is not an
61
     * actual object (typically keyword). This includes the
62
     * NULL case. Nothing to free in that case. */
63
2.76M
    if ((uintptr_t)o < TOKEN__LAST_KEY)
64
18
        return;
65
66
#if defined(DEBUG) || REFCNT_DEBUG
67
    ctx = (pdf_context *)o->ctx;
68
#endif
69
#ifdef DEBUG
70
    if (o->refcnt == 0)
71
        emprintf(OBJ_MEMORY(o), "Decrementing object with refcount at 0!\n");
72
#endif
73
2.76M
    o->refcnt--;
74
#if REFCNT_DEBUG
75
    outprintf(ctx->memory, "Decrementing reference count of object %d, UID %lu, to %d\n", o->object_num, o->UID, o->refcnt);
76
#endif
77
2.76M
    if (o->refcnt != 0)
78
2.13M
        return;
79
#if REFCNT_DEBUG
80
    if (ctx != NULL && ctx->cache_entries != 0) {
81
        pdf_obj_cache_entry *entry = ctx->cache_LRU, *next;
82
83
        while(entry) {
84
            next = entry->next;
85
            if (entry->o->object_num != 0 && entry->o->object_num == o->object_num)
86
                outprintf(ctx->memory, "Freeing object %d, UID %lu, but there is still a cache entry!\n", o->object_num, o->UID);
87
            entry = next;
88
        }
89
    }
90
    outprintf(ctx->memory, "Freeing object %d, UID %lu\n", o->object_num, o->UID);
91
#endif
92
#ifdef DEBUG
93
    if (ctx->xref_table != NULL && o->object_num > 0 &&
94
        o->object_num < ctx->xref_table->xref_size &&
95
        ctx->xref_table->xref[o->object_num].cache != NULL &&
96
        ctx->xref_table->xref[o->object_num].cache->o == o) {
97
        outprintf(ctx->memory, "Freeing object %d while it is still in the object cache!\n", o->object_num);
98
    }
99
#endif
100
628k
    pdfi_free_object(o);
101
628k
}
102
103
/* These two macros are present simply to add a cast to the generic object type, so that
104
 * we don't get warnings in the implementation routines, the alternative would be to use
105
 * a cast everywhere we use the inline functions above, or to have them take a void *
106
 *
107
 * Ordinarily we would capitalise the name of a macro to differentiate it from a function
108
 * we make an exception in this case because hte macro descends to an inline function which
109
 * can be debugged without expanding macros.
110
 */
111
92.5M
#define pdfi_countup(x) pdfi_countup_impl((pdf_obj *)x)
112
113
108M
#define pdfi_countdown(x) pdfi_countdown_impl((pdf_obj *)x)
114
115
/* Why two functions ? The difference is that when interpreting 'sub' streams
116
 * such as the content stream for a Form XObject, we may have entries on the
117
 * stack at the start of the stream interpretation, and we don't want to
118
 * pop any of those off during the course of the stream. The stack depth stored in
119
 * the context is used to prevent this in pdfi_pop().
120
 * This means that, during the course of a stream, the stack top - bottom may
121
 * not be an accurate reflection of the number of available items on the stack.
122
 *
123
 * So pdfi_count_stack() returns the number of available items, and
124
 * pdfi_count_stack_total() returns the entire size of the stack, and is used to
125
 * record the saved stack depth when we start a stream.
126
 *
127
 * Although these are currently simple calculations, they are abstracted in order
128
 * to facilitate later replacement if required.
129
 */
130
static inline int pdfi_count_total_stack(pdf_context *ctx)
131
55.1M
{
132
55.1M
    return (ctx->stack_top - ctx->stack_bot);
133
55.1M
}
Unexecuted instantiation: zpdfops.c:pdfi_count_total_stack
Unexecuted instantiation: ghostpdf.c:pdfi_count_total_stack
Unexecuted instantiation: pdf_dict.c:pdfi_count_total_stack
Unexecuted instantiation: pdf_array.c:pdfi_count_total_stack
pdf_xref.c:pdfi_count_total_stack
Line
Count
Source
131
44.8k
{
132
44.8k
    return (ctx->stack_top - ctx->stack_bot);
133
44.8k
}
pdf_int.c:pdfi_count_total_stack
Line
Count
Source
131
19.3M
{
132
19.3M
    return (ctx->stack_top - ctx->stack_bot);
133
19.3M
}
Unexecuted instantiation: pdf_file.c:pdfi_count_total_stack
Unexecuted instantiation: pdf_path.c:pdfi_count_total_stack
pdf_colour.c:pdfi_count_total_stack
Line
Count
Source
131
58.9k
{
132
58.9k
    return (ctx->stack_top - ctx->stack_bot);
133
58.9k
}
Unexecuted instantiation: pdf_pattern.c:pdfi_count_total_stack
pdf_gstate.c:pdfi_count_total_stack
Line
Count
Source
131
689k
{
132
689k
    return (ctx->stack_top - ctx->stack_bot);
133
689k
}
pdf_stack.c:pdfi_count_total_stack
Line
Count
Source
131
29.6M
{
132
29.6M
    return (ctx->stack_top - ctx->stack_bot);
133
29.6M
}
pdf_image.c:pdfi_count_total_stack
Line
Count
Source
131
18.5k
{
132
18.5k
    return (ctx->stack_top - ctx->stack_bot);
133
18.5k
}
Unexecuted instantiation: pdf_page.c:pdfi_count_total_stack
Unexecuted instantiation: pdf_annot.c:pdfi_count_total_stack
Unexecuted instantiation: pdf_mark.c:pdfi_count_total_stack
pdf_font.c:pdfi_count_total_stack
Line
Count
Source
131
121k
{
132
121k
    return (ctx->stack_top - ctx->stack_bot);
133
121k
}
Unexecuted instantiation: pdf_font0.c:pdfi_count_total_stack
Unexecuted instantiation: pdf_font1.c:pdfi_count_total_stack
Unexecuted instantiation: pdf_font1C.c:pdfi_count_total_stack
Unexecuted instantiation: pdf_fontps.c:pdfi_count_total_stack
Unexecuted instantiation: pdf_font3.c:pdfi_count_total_stack
Unexecuted instantiation: pdf_fontTT.c:pdfi_count_total_stack
Unexecuted instantiation: pdf_font11.c:pdfi_count_total_stack
Unexecuted instantiation: pdf_cmap.c:pdfi_count_total_stack
pdf_fmap.c:pdfi_count_total_stack
Line
Count
Source
131
5.01k
{
132
5.01k
    return (ctx->stack_top - ctx->stack_bot);
133
5.01k
}
pdf_text.c:pdfi_count_total_stack
Line
Count
Source
131
325k
{
132
325k
    return (ctx->stack_top - ctx->stack_bot);
133
325k
}
pdf_shading.c:pdfi_count_total_stack
Line
Count
Source
131
12.1k
{
132
12.1k
    return (ctx->stack_top - ctx->stack_bot);
133
12.1k
}
Unexecuted instantiation: pdf_func.c:pdfi_count_total_stack
Unexecuted instantiation: pdf_trans.c:pdfi_count_total_stack
Unexecuted instantiation: pdf_device.c:pdfi_count_total_stack
Unexecuted instantiation: pdf_misc.c:pdfi_count_total_stack
pdf_optcontent.c:pdfi_count_total_stack
Line
Count
Source
131
37.3k
{
132
37.3k
    return (ctx->stack_top - ctx->stack_bot);
133
37.3k
}
Unexecuted instantiation: pdf_check.c:pdfi_count_total_stack
Unexecuted instantiation: pdf_sec.c:pdfi_count_total_stack
Unexecuted instantiation: pdf_utf8.c:pdfi_count_total_stack
pdf_deref.c:pdfi_count_total_stack
Line
Count
Source
131
1.14M
{
132
1.14M
    return (ctx->stack_top - ctx->stack_bot);
133
1.14M
}
pdf_repair.c:pdfi_count_total_stack
Line
Count
Source
131
3.69M
{
132
3.69M
    return (ctx->stack_top - ctx->stack_bot);
133
3.69M
}
Unexecuted instantiation: pdf_obj.c:pdfi_count_total_stack
Unexecuted instantiation: pdf_doc.c:pdfi_count_total_stack
Unexecuted instantiation: pdf_fapi.c:pdfi_count_total_stack
134
135
static inline int pdfi_count_stack(pdf_context *ctx)
136
55.0M
{
137
55.0M
    return (pdfi_count_total_stack(ctx)) - ctx->current_stream_save.stack_count;
138
55.0M
}
Unexecuted instantiation: zpdfops.c:pdfi_count_stack
Unexecuted instantiation: ghostpdf.c:pdfi_count_stack
Unexecuted instantiation: pdf_dict.c:pdfi_count_stack
Unexecuted instantiation: pdf_array.c:pdfi_count_stack
pdf_xref.c:pdfi_count_stack
Line
Count
Source
136
44.8k
{
137
44.8k
    return (pdfi_count_total_stack(ctx)) - ctx->current_stream_save.stack_count;
138
44.8k
}
pdf_int.c:pdfi_count_stack
Line
Count
Source
136
19.3M
{
137
19.3M
    return (pdfi_count_total_stack(ctx)) - ctx->current_stream_save.stack_count;
138
19.3M
}
Unexecuted instantiation: pdf_file.c:pdfi_count_stack
Unexecuted instantiation: pdf_path.c:pdfi_count_stack
pdf_colour.c:pdfi_count_stack
Line
Count
Source
136
58.9k
{
137
58.9k
    return (pdfi_count_total_stack(ctx)) - ctx->current_stream_save.stack_count;
138
58.9k
}
Unexecuted instantiation: pdf_pattern.c:pdfi_count_stack
pdf_gstate.c:pdfi_count_stack
Line
Count
Source
136
689k
{
137
689k
    return (pdfi_count_total_stack(ctx)) - ctx->current_stream_save.stack_count;
138
689k
}
pdf_stack.c:pdfi_count_stack
Line
Count
Source
136
29.5M
{
137
29.5M
    return (pdfi_count_total_stack(ctx)) - ctx->current_stream_save.stack_count;
138
29.5M
}
pdf_image.c:pdfi_count_stack
Line
Count
Source
136
18.5k
{
137
18.5k
    return (pdfi_count_total_stack(ctx)) - ctx->current_stream_save.stack_count;
138
18.5k
}
Unexecuted instantiation: pdf_page.c:pdfi_count_stack
Unexecuted instantiation: pdf_annot.c:pdfi_count_stack
Unexecuted instantiation: pdf_mark.c:pdfi_count_stack
pdf_font.c:pdfi_count_stack
Line
Count
Source
136
121k
{
137
121k
    return (pdfi_count_total_stack(ctx)) - ctx->current_stream_save.stack_count;
138
121k
}
Unexecuted instantiation: pdf_font0.c:pdfi_count_stack
Unexecuted instantiation: pdf_font1.c:pdfi_count_stack
Unexecuted instantiation: pdf_font1C.c:pdfi_count_stack
Unexecuted instantiation: pdf_fontps.c:pdfi_count_stack
Unexecuted instantiation: pdf_font3.c:pdfi_count_stack
Unexecuted instantiation: pdf_fontTT.c:pdfi_count_stack
Unexecuted instantiation: pdf_font11.c:pdfi_count_stack
Unexecuted instantiation: pdf_cmap.c:pdfi_count_stack
pdf_fmap.c:pdfi_count_stack
Line
Count
Source
136
5.01k
{
137
5.01k
    return (pdfi_count_total_stack(ctx)) - ctx->current_stream_save.stack_count;
138
5.01k
}
pdf_text.c:pdfi_count_stack
Line
Count
Source
136
325k
{
137
325k
    return (pdfi_count_total_stack(ctx)) - ctx->current_stream_save.stack_count;
138
325k
}
pdf_shading.c:pdfi_count_stack
Line
Count
Source
136
12.1k
{
137
12.1k
    return (pdfi_count_total_stack(ctx)) - ctx->current_stream_save.stack_count;
138
12.1k
}
Unexecuted instantiation: pdf_func.c:pdfi_count_stack
Unexecuted instantiation: pdf_trans.c:pdfi_count_stack
Unexecuted instantiation: pdf_device.c:pdfi_count_stack
Unexecuted instantiation: pdf_misc.c:pdfi_count_stack
pdf_optcontent.c:pdfi_count_stack
Line
Count
Source
136
37.3k
{
137
37.3k
    return (pdfi_count_total_stack(ctx)) - ctx->current_stream_save.stack_count;
138
37.3k
}
Unexecuted instantiation: pdf_check.c:pdfi_count_stack
Unexecuted instantiation: pdf_sec.c:pdfi_count_stack
Unexecuted instantiation: pdf_utf8.c:pdfi_count_stack
pdf_deref.c:pdfi_count_stack
Line
Count
Source
136
1.14M
{
137
1.14M
    return (pdfi_count_total_stack(ctx)) - ctx->current_stream_save.stack_count;
138
1.14M
}
pdf_repair.c:pdfi_count_stack
Line
Count
Source
136
3.69M
{
137
3.69M
    return (pdfi_count_total_stack(ctx)) - ctx->current_stream_save.stack_count;
138
3.69M
}
Unexecuted instantiation: pdf_obj.c:pdfi_count_stack
Unexecuted instantiation: pdf_doc.c:pdfi_count_stack
Unexecuted instantiation: pdf_fapi.c:pdfi_count_stack
139
140
#endif