123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- $OpenBSD: patch-index_build_in_c,v 1.1 2017/05/07 21:41:51 stu Exp $
- Index: index/build_in.c
- --- index/build_in.c.orig
- +++ index/build_in.c
- @@ -44,6 +44,13 @@ extern struct stat istbuf;
- extern struct stat excstbuf;
- extern struct stat incstbuf;
-
- +void build_hash();
- +void init_hash_table();
- +void insert_h();
- +void insert_index();
- +void merge_in(FILE *, FILE *, FILE *);
- +void remove_filename(int, int);
- +
- extern int ICurrentFileOffset;
- extern int NextICurrentFileOffset;
-
- @@ -121,6 +128,7 @@ extern struct indices *ip;
- extern int HashTableSize;
- struct token **hash_table; /*[MAX_64K_HASH];*/
-
- +void
- build_index()
- {
- int i;
- @@ -595,6 +603,7 @@ next_token:
- #endif
- }
-
- +void
- traverse1()
- {
- FILE *i1, *i2, *i3;
- @@ -777,6 +786,7 @@ build_hash():
- input: a set of filenames in name_list[], a partition table p_table[]
- output: a hash table hash_table[].
- -----------------------------------------------------------------------*/
- +void
- build_hash()
- {
- int fd; /* opened file number */
- @@ -1226,6 +1236,7 @@ try_again_1:
- my_free(buffer_begin, BLOCK_SIZE + 10);
- }
-
- +void
- init_hash_table()
- {
- int i;
- @@ -1245,6 +1256,7 @@ function: insert the word to appropriate position in t
- otherwise create a new token.
- THERE ARE NO STATE CHANGES UNLESS WE ARE SURE THAT MALLOCS WON'T FAIL: BG
- ---------------------------------------------------------------------------*/
- +void
- insert_h(word, pn, attribute)
- char *word;
- int pn;
- @@ -1282,7 +1294,8 @@ int attribute;
- traverse1();
- init_hash_table();
- tried_once = 1; /* memory allocation failed in malloc#1 */
- - return insert_h(word, pn, attribute); /* next call can't fail here since traverse() calls *allfree() */
- + insert_h(word, pn, attribute); /* next call can't fail here since traverse() calls *allfree() */
- + return;
- }
-
- if((tp->word = (char *) wordalloc(sizeof(char) * (wordlen+1))) == NULL) {
- @@ -1297,7 +1310,8 @@ int attribute;
- traverse1();
- init_hash_table();
- tried_once = 2; /* memory allocation failed in malloc#2 */
- - return insert_h(word, pn, attribute); /* next call can't fail here or above since traverse() calls *allfree() */
- + insert_h(word, pn, attribute); /* next call can't fail here or above since traverse() calls *allfree() */
- + return;
- }
- strcpy(tp->word, word);
- tp->attribute = attribute;
- @@ -1317,7 +1331,8 @@ int attribute;
- traverse1();
- init_hash_table();
- tried_once = 3; /* memory allocation failed in malloc#3 */
- - return insert_h(word, pn, attribute); /* next call can't fail here or above or above-above since traverse() calls *allfree() */
- + insert_h(word, pn, attribute); /* next call can't fail here or above or above-above since traverse() calls *allfree() */
- + return;
- }
- icount++;
-
- @@ -1363,6 +1378,7 @@ tp points to the token structure. so, tp->ip is always
- indices structure.
- THERE ARE NO STATE CHANGES UNLESS WE ARE SURE THAT MALLOCS WON'T FAIL: BG
- ------------------------------------------------------------------- */
- +void
- insert_index(tp, pn)
- struct token *tp; /* insert a index into a indices structure */
- int pn;
- @@ -1411,7 +1427,8 @@ int pn;
- traverse1();
- init_hash_table();
- tried_once = 1; /* memory allocation failed in malloc#1 */
- - return insert_index(tp, pn);
- + insert_index(tp, pn);
- + return;
- }
- icount++;
-
- @@ -1471,6 +1488,7 @@ extern unsigned char *dest_index_buf;
- extern unsigned char *merge_index_buf;
-
- /* merge index file f1 and f2, then put the result in index file f3 */
- +void
- merge_in(f1, f2, f3)
- FILE *f1, *f2, *f3;
- {
- @@ -1849,6 +1867,7 @@ printf("in merge_in()\n"); fflush(stdout);
- return;
- }
-
- +void
- remove_filename(fileindex, new_partition)
- int fileindex, new_partition;
- {
|