This file is indexed.

/usr/include/avro/allocation.h is in libavro-dev 1.8.2-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to you under the Apache License, Version 2.0 
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 * implied.  See the License for the specific language governing
 * permissions and limitations under the License. 
 */

#ifndef AVRO_ALLOCATION_H
#define AVRO_ALLOCATION_H
#ifdef __cplusplus
extern "C" {
#define CLOSE_EXTERN }
#else
#define CLOSE_EXTERN
#endif

#include <stdlib.h>

/*
 * Allocation interface.  You can provide a custom allocator for the
 * library, should you wish.  The allocator is provided as a single
 * generic function, which can emulate the standard malloc, realloc, and
 * free functions.  The design of this allocation interface is inspired
 * by the implementation of the Lua interpreter.
 *
 * The ptr parameter will be the location of any existing memory
 * buffer.  The osize parameter will be the size of this existing
 * buffer.  If ptr is NULL, then osize will be 0.  The nsize parameter
 * will be the size of the new buffer, or 0 if the new buffer should be
 * freed.
 *
 * If nsize is 0, then the allocation function must return NULL.  If
 * nsize is not 0, then it should return NULL if the allocation fails.
 */

typedef void *
(*avro_allocator_t)(void *user_data, void *ptr, size_t osize, size_t nsize);

void avro_set_allocator(avro_allocator_t alloc, void *user_data);

struct avro_allocator_state {
	avro_allocator_t  alloc;
	void  *user_data;
};

extern struct avro_allocator_state  AVRO_CURRENT_ALLOCATOR;

#define avro_realloc(ptr, osz, nsz)          \
	(AVRO_CURRENT_ALLOCATOR.alloc        \
	 (AVRO_CURRENT_ALLOCATOR.user_data,  \
	  (ptr), (osz), (nsz)))

#define avro_malloc(sz) (avro_realloc(NULL, 0, (sz)))
#define avro_free(ptr, osz) (avro_realloc((ptr), (osz), 0))

#define avro_new(type) (avro_realloc(NULL, 0, sizeof(type)))
#define avro_freet(type, ptr) (avro_realloc((ptr), sizeof(type), 0))

void *avro_calloc(size_t count, size_t size);

/*
 * This is probably too clever for our own good, but when we duplicate a
 * string, we actually store its size in the same allocated memory
 * buffer.  That lets us free the string later, without having to call
 * strlen to get its size, and without the containing struct having to
 * manually store the strings length.
 *
 * This means that any string return by avro_strdup MUST be freed using
 * avro_str_free, and the only thing that can be passed into
 * avro_str_free is a string created via avro_strdup.
 */

char *avro_str_alloc(size_t str_size);
char *avro_strdup(const char *str);
char *avro_strndup(const char *str, size_t size);
void avro_str_free(char *str);

CLOSE_EXTERN
#endif