This file is indexed.

/usr/share/doc/libetpan-doc/API/x161.htm is in libetpan-doc 1.8.0-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
 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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>Hash table</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="libEtPan! API"
HREF="book1.htm"><LINK
REL="UP"
TITLE="Tools and datatypes"
HREF="c16.htm"><LINK
REL="PREVIOUS"
TITLE="List"
HREF="x88.htm"><LINK
REL="NEXT"
TITLE="Buffered I/O"
HREF="x229.htm"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>libEtPan! API</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="x88.htm"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 2. Tools and datatypes</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="x229.htm"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN161"
>Hash table</A
></H1
><PRE
CLASS="PROGRAMLISTING"
>#include &lt;libetpan/libetpan.h&gt;

typedef struct chash chash;

typedef struct chashcell chashiter;

typedef struct {
  char * data;
  int len;
} chashdatum;
      </PRE
><P
>      
        <B
CLASS="COMMAND"
>chash</B
> is a hash table.
        <B
CLASS="COMMAND"
>chashiter</B
> is a pointer to an element of the
        hash table.
        <B
CLASS="COMMAND"
>chashdatum</B
> is an element to be placed in
        the hash table as a key or a value. It consists in 
        data and a corresponding length.
      </P
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="CHASH-NEW"
>chash_new and chash_free</A
></H2
><PRE
CLASS="PROGRAMLISTING"
>#define CHASH_COPYNONE    0
#define CHASH_COPYKEY     1
#define CHASH_COPYVALUE   2
#define CHASH_COPYALL     (CHASH_COPYKEY | CHASH_COPYVALUE)

chash * chash_new(int size, int flags);

void chash_free(chash * hash);
        </PRE
><P
>          <B
CLASS="COMMAND"
>chash_new()</B
> returns a new empty hash table
          or <B
CLASS="COMMAND"
>NULL</B
> if this
          failed. <B
CLASS="COMMAND"
>size</B
> is the initial size of the
          table used for implementation. <B
CLASS="COMMAND"
>flags</B
> can
          be a combinaison of <B
CLASS="COMMAND"
>CHASH_COPYKEY</B
> and
          <B
CLASS="COMMAND"
>CHASH_COPYVALUE</B
>.
          <B
CLASS="COMMAND"
>CHASH_COPYKEY</B
> enables copy of key, so
          that the initial value used for <B
CLASS="COMMAND"
>chash_set()</B
>
        </P
><P
>          <B
CLASS="COMMAND"
>chash_free()</B
> releases memory used by the
          hash table.
        </P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="CHASH-GET"
>chash_set and chash_get</A
></H2
><PRE
CLASS="PROGRAMLISTING"
>int chash_set(chash * hash,
    chashdatum * key, chashdatum * value, chashdatum * oldvalue);

int chash_get(chash * hash,
    chashdatum * key, chashdatum * result);
        </PRE
><P
>          <B
CLASS="COMMAND"
>chash_set()</B
> adds a new element into the
          hash table. If a previous element had the same key, it is
          returns into oldvalue if <B
CLASS="COMMAND"
>oldvalue</B
> is
          different of NULL.
          Medium complexity is O(1).
        </P
><P
>          returns -1 if it fails, 0 on success.
        </P
><P
>          <B
CLASS="COMMAND"
>chash_get()</B
>returns the corresponding value
          of the given key. If there is no corresponding value, -1 is
          returned. 0 on success.
          Medium complexity is O(1).
        </P
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN191"
></A
><P
><B
>Example 2-9. chash insert and lookup</B
></P
><PRE
CLASS="PROGRAMLISTING"
>int main(void)
{
  chash * hash;
  int r;
  chashdatum key;
  chashdatum value;
  char * str1 = "my-data";
  char * str2 = "my-data";

  hash = chash_new(CHASH_DEFAULTSIZE, CHASH_COPYNONE);

  key.data = "foo";
  key.len = strlen("foo");  
  value.data = str1;
  value.data = strlen(str1) + 1;
  /* + 1 is needed to get the terminal zero in the returned string */
  r = chash_set(hash, &amp;key, &amp;value, NULL);
  if (r &lt; 0)
    goto free_hash;

  key.data = "bar";
  key.len = strlen("bar");  
  value.data = str2;
  value.data = strlen(str2) + 1;
  if (r &lt; 0)
    goto free_hash;
  
  key.data = "foo";
  key.len = strlen("foo");  
  r = chash_get(hash, &amp;key, &amp;value);
  if (r &lt; 0) {
    printf("element not found\n");
  }
  else {
    char * str;

    str = value.data;
    printf("found : %s", str);
  }
  
  chash_free(hash);

  exit(EXIT_SUCCESS);

 free_hash:
  chash_free(hash);
 err:
  exit(EXIT_FAILURE);
}
          </PRE
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="CHASH-DELETE"
>chash_delete</A
></H2
><PRE
CLASS="PROGRAMLISTING"
>int chash_delete(chash * hash,
    chashdatum * key, chashdatum * oldvalue);
        </PRE
><P
>          deletes the key/value pair given the corresponding key.
          The value is returned in old_value.
          If there is no corresponding value, -1 is returned. 0 on success.
          Medium complexity is O(1).
        </P
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN198"
></A
><P
><B
>Example 2-10. key deletion in a chash</B
></P
><PRE
CLASS="PROGRAMLISTING"
>int main(void)
{
  chash * hash;
  int r;
  chashdatum key;
  chashdatum value;
  char * str1 = "my-data";
  char * str2 = "my-data";

  hash = build_hash();
  
  key.data = "foo";
  key.len = strlen("foo");  
  chash_delete(hash, &amp;key, &amp;value);

  /* it will never be possible to lookup "foo" */
  key.data = "foo";
  key.len = strlen("foo");
  r = chash_get(hash, &amp;key, &amp;value);
  if (r &lt; 0) {
    printf("element not found\n");
  }
  else {
    char * str;

    str = value.data;
    printf("found : %s", str);
  }
  
  chash_free(hash);

  exit(EXIT_SUCCESS);

 free_hash:
  chash_free(hash);
 err:
  exit(EXIT_FAILURE);
}
          </PRE
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="CHASH-RESIZE"
>chash_resize</A
></H2
><PRE
CLASS="PROGRAMLISTING"
>int chash_resize(chash * hash, int size);
        </PRE
><P
>          <B
CLASS="COMMAND"
>chash_resize()</B
> changes the size of the
          table used for implementation of the hash table.
          returns 0 on success, -1 on failure.
        </P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="CHASH-BEGIN"
>running through the chash</A
></H2
><PRE
CLASS="PROGRAMLISTING"
>chashiter * chash_begin(chash * hash);

chashiter * chash_next(chash * hash, chashiter * iter);

void chash_key(chashiter * iter, chashdatum * result);

void chash_value(chashiter iter, chashdatum * result);
        </PRE
><P
>          <B
CLASS="COMMAND"
>chash_begin()</B
> returns a pointer to the
          first element of the hash table. Returns
          <B
CLASS="COMMAND"
>NULL</B
> if there is no elements in the hash
          table.
          Complexity is O(n).
        </P
><P
>          <B
CLASS="COMMAND"
>chash_next()</B
> returns a pointer to the next
          element of the hash table. Returns <B
CLASS="COMMAND"
>NULL</B
>
          if there is no next element.
          Complexity is O(n) but n calls to chash_next() also has 
          a complexity of O(n).
        </P
><P
>          <B
CLASS="COMMAND"
>chash_key()</B
> returns the key of the given
          element of the hash table.
        </P
><P
>          <B
CLASS="COMMAND"
>chash_value</B
> returns the value of the
          given element of the hash table.
        </P
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN219"
></A
><P
><B
>Example 2-11. running through a chash</B
></P
><PRE
CLASS="PROGRAMLISTING"
>int main(void)
{
  chash * hash;
  int r;
  chashiter * iter;

  hash = build_hash();

  /* this will display all the values stored in the hash */
  for(iter = chash_begin(hash) ; iter != NULL ; iter =
    chash_next(hash, iter)) {
    chashdatum key;
    chashdatum value;
    char * str;

    chash_value(iter, &amp;value);
    str = value.data;
    printf("%s\n", str);
  }

  chash_free(hash);
}
          </PRE
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="CHASH-COUNT"
>chash_size and chash_count</A
></H2
><PRE
CLASS="PROGRAMLISTING"
>int chash_size(chash * hash);

int chash_count(chash * hash);
        </PRE
><P
>          <B
CLASS="COMMAND"
>chash_size()</B
> returns the size of the table
          used for implementation of the hash table.
          Complexity is O(1).
        </P
><P
>          <B
CLASS="COMMAND"
>chash_count()</B
> returns the number of
          elements in the hash table.
          Complexity is O(1).
        </P
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="x88.htm"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="book1.htm"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="x229.htm"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>List</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="c16.htm"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Buffered I/O</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>