File: addl.c

package info (click to toggle)
icmake 7.11-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 2,804 kB
  • ctags: 1,541
  • sloc: ansic: 7,755; makefile: 6,063; sh: 359; cpp: 83
file content (25 lines) | stat: -rw-r--r-- 536 bytes parent folder | download | duplicates (4)
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
#include "list.ih"

void listAdd_L(LISTVAR_ *dest, LISTVAR_ const *rhs)
{
    size_t idx;
    size_t nRhs = size(rhs);

    if (nRhs)                      /* something to add   */
    {
        LISTVAR_ copy = *listCopyCons(dest);

        for (idx = 0; idx < nRhs; ++idx)
        {
            char const *cp = element(rhs)[idx];
            if (!listContains(&copy, cp))
                listAdd_cP(&copy, cp);
        }

        if (size(&copy) != size(dest))
            assign(dest, &copy);

        listDestructor(&copy);
    }
}