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 void
change_branch_reviewer_add(change::pointer cp,string_ty * usrnam)27 change_branch_reviewer_add(change::pointer cp, string_ty *usrnam)
28 {
29 cstate_ty *cstate_data;
30 meta_type *type_p;
31 string_ty **spp;
32 cstate_branch_reviewer_list_ty *lp;
33 size_t j;
34
35 trace(("change_branch_reviewer_add(cp = %p, "
36 "usrnam = \"%s\")\n{\n", cp, usrnam->str_text));
37 cstate_data = cp->cstate_get();
38 assert(cstate_data->branch);
39 if (!cstate_data->branch->reviewer)
40 {
41 cstate_data->branch->reviewer =
42 (cstate_branch_reviewer_list_ty *)
43 cstate_branch_reviewer_list_type.alloc();
44 }
45 lp = cstate_data->branch->reviewer;
46
47 //
48 // make sure we don't have her already
49 //
50 for (j = 0; j < lp->length; ++j)
51 {
52 if (str_equal(usrnam, lp->list[j]))
53 {
54 trace(("}\n"));
55 return;
56 }
57 }
58
59 //
60 // append her to the list
61 //
62 spp =
63 (string_ty **)
64 cstate_branch_reviewer_list_type.list_parse
65 (
66 cstate_data->branch->reviewer,
67 &type_p
68 );
69 assert(type_p == &string_type);
70 *spp = str_copy(usrnam);
71 trace(("}\n"));
72 }
73
74
75 // vim: set ts=8 sw=4 et :
76