8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / lib / krb5 / ss / request_tbl.c
blob18004d2bd32403530ccb80249784aa81b11cab53
1 /*
2 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
3 * Use is subject to license terms.
4 */
6 #pragma ident "%Z%%M% %I% %E% SMI"
8 /*
9 * Copyright 1987, 1988 by MIT Student Information Processing Board
11 * For copyright information, see copyright.h.
14 #include "copyright.h"
15 #include "ss_internal.h"
17 #define ssrt ss_request_table /* for some readable code... */
19 void
20 ss_add_request_table(sci_idx, rqtbl_ptr, position, code_ptr)
21 int sci_idx;
22 ssrt *rqtbl_ptr;
23 int position; /* 1 -> becomes second... */
24 int *code_ptr;
26 register ss_data *info;
27 register int i, size;
29 info = ss_info(sci_idx);
30 for (size=0; info->rqt_tables[size] != (ssrt *)NULL; size++)
32 /* size == C subscript of NULL == #elements */
33 size += 2; /* new element, and NULL */
34 info->rqt_tables = (ssrt **)realloc(info->rqt_tables,
35 size*sizeof(ssrt));
36 if (info->rqt_tables == (ssrt **)NULL) {
37 *code_ptr = errno;
38 return;
40 if (position > size - 2)
41 position = size - 2;
43 if (size > 1)
44 for (i = size - 2; i >= position; i--)
45 info->rqt_tables[i+1] = info->rqt_tables[i];
47 info->rqt_tables[position] = rqtbl_ptr;
48 info->rqt_tables[size-1] = (ssrt *)NULL;
49 *code_ptr = 0;
52 void
53 ss_delete_request_table(sci_idx, rqtbl_ptr, code_ptr)
54 int sci_idx;
55 ssrt *rqtbl_ptr;
56 int *code_ptr;
58 register ss_data *info;
59 register ssrt **rt1, **rt2;
61 *code_ptr = SS_ET_TABLE_NOT_FOUND;
62 info = ss_info(sci_idx);
63 rt1 = info->rqt_tables;
64 for (rt2 = rt1; *rt1; rt1++) {
65 if (*rt1 != rqtbl_ptr) {
66 *rt2++ = *rt1;
67 *code_ptr = 0;
70 *rt2 = (ssrt *)NULL;
71 return;