1 //
2 // aegis - project change supervisor
3 // Copyright (C) 2001, 2003-2008, 2012 Peter Miller
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program. If not, see
17 // <http://www.gnu.org/licenses/>.
18 //
19
20 #include <common/ac/assert.h>
21
22 #include <common/trace.h>
23 #include <libaegis/change/branch.h>
24
25
26 string_ty *
change_branch_reviewer_nth(change::pointer cp,long n)27 change_branch_reviewer_nth(change::pointer cp, long n)
28 {
29 cstate_ty *cstate_data;
30 cstate_branch_reviewer_list_ty *lp;
31 string_ty *result;
32
33 trace(("change_branch_reviewer_nth(cp = %p, n = %ld)\n{\n",
34 cp, n));
35 cstate_data = cp->cstate_get();
36 assert(cstate_data->branch);
37 if (!cstate_data->branch->reviewer)
38 {
39 cstate_data->branch->reviewer =
40 (cstate_branch_reviewer_list_ty *)
41 cstate_branch_reviewer_list_type.alloc();
42 }
43 lp = cstate_data->branch->reviewer;
44
45 if (n < 0 || (size_t)n >= lp->length)
46 result = 0;
47 else
48 result = lp->list[n];
49 trace(("return %p;\n", result));
50 trace(("}\n"));
51 return result;
52 }
53
54
55 // vim: set ts=8 sw=4 et :
56