Debian Codegraph @

packages/seacas/libraries/chaco/eigen/mkscanlist.c

raw
1 /*
2 * Copyright(C) 1999-2020 National Technology & Engineering Solutions
3 * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
4 * NTESS, the U.S. Government retains certain rights in this software.
5 *
6 * See packages/seacas/LICENSE for details
7 */
8
9 #include "smalloc.h" // for smalloc
10 #include "structs.h" // for scanlink
11 #include <stdio.h> // for NULL
12
13 struct scanlink *mkscanlist(int depth)
14 {
15 struct scanlink *prevlnk;
16 struct scanlink *newlnk;
17 int i;
18
19 prevlnk = smalloc(sizeof(struct scanlink));
20 prevlnk->pntr = NULL;
21 newlnk = prevlnk; /* in case the list is one long */
22 for (i = 1; i <= (depth - 1); i++) {
23 newlnk = smalloc(sizeof(struct scanlink));
24 newlnk->pntr = prevlnk;
25 prevlnk = newlnk;
26 }
27 return (newlnk);
28 }