This file is indexed.

/usr/include/soldout/array.h is in libsoldout1-dev 1.3-6.

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
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/* array.h - automatic dynamic array for pointers */

/*
 * Copyright (c) 2008, Natacha Porté
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#ifndef LITHIUM_ARRAY_H
#define LITHIUM_ARRAY_H

#include <stdlib.h>


/********************
 * TYPE DEFINITIONS *
 ********************/

/* struct array • generic linear array */
struct array {
	void*	base;
	int	size;
	int	asize;
	size_t	unit; };


/* struct parray • array of pointers */
struct parray {
	void **	item;
	int	size;
	int	asize; };


/* array_cmp_fn • comparison functions for sorted arrays */
typedef int (*array_cmp_fn)(void *key, void *array_entry);



/***************************
 * GENERIC ARRAY FUNCTIONS *
 ***************************/

/* arr_adjust • shrink the allocated memory to fit exactly the needs */
int
arr_adjust(struct array *);

/* arr_free • frees the structure contents (buf NOT the struct itself) */
void
arr_free(struct array *);

/* arr_grow • increases the array size to fit the given number of elements */
int
arr_grow(struct array *, int);

/* arr_init • initialization of the contents of the struct */
void
arr_init(struct array *, size_t);

/* arr_insert • inserting elements nb before the nth one */
int
arr_insert(struct array *, int nb, int n);

/* arr_item • returns a pointer to the n-th element */
void *
arr_item(struct array *, int);

/* arr_newitem • returns the index of a new element appended to the array */
int
arr_newitem(struct array *);

/* arr_remove • removes the n-th elements of the array */
void
arr_remove(struct array *, int);

/* arr_sorted_find • O(log n) search in a sorted array, returning entry */
/* equivalent to bsearch(key, arr->base, arr->size, arr->unit, cmp) */
void *
arr_sorted_find(struct array *, void *key, array_cmp_fn cmp);

/* arr_sorted_find_i • O(log n) search in a sorted array,
 *      returning index of the smallest element larger than the key */
int
arr_sorted_find_i(struct array *, void *key, array_cmp_fn cmp);


/***************************
 * POINTER ARRAY FUNCTIONS *
 ***************************/

/* parr_adjust • shrinks the allocated memory to fit exactly the needs */
int
parr_adjust(struct parray *);

/* parr_free • frees the structure contents (buf NOT the struct itself) */
void
parr_free(struct parray *);

/* parr_grow • increases the array size to fit the given number of elements */
int
parr_grow(struct parray *, int);

/* parr_init • initialization of the struct (which is equivalent to zero) */
void
parr_init(struct parray *);

/* parr_insert • inserting nb elements before the nth one */
int
parr_insert(struct parray *, int nb, int n);

/* parr_pop • pops the last item of the array and returns it */
void *
parr_pop(struct parray *);

/* parr_push • pushes a pointer at the end of the array (= append) */
int
parr_push(struct parray *, void *);

/* parr_remove • removes the n-th element of the array and returns it */
void *
parr_remove(struct parray *, int);

/* parr_sorted_find • O(log n) search in a sorted array, returning entry */
void *
parr_sorted_find(struct parray *, void *key, array_cmp_fn cmp);

/* parr_sorted_find_i • O(log n) search in a sorted array,
 *      returning index of the smallest element larger than the key */
int
parr_sorted_find_i(struct parray *, void *key, array_cmp_fn cmp);

/* parr_top • returns the top the stack (i.e. the last element of the array) */
void *
parr_top(struct parray *);


#endif /* ndef LITHIUM_ARRAY_H */

/* vim: set filetype=c: */