aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/depmap.c23
-rw-r--r--src/pies.h12
-rw-r--r--src/progman.c22
3 files changed, 28 insertions, 29 deletions
diff --git a/src/depmap.c b/src/depmap.c
index 1775e06..0b8cb0f 100644
--- a/src/depmap.c
+++ b/src/depmap.c
@@ -20,7 +20,6 @@
# define CHAR_BIT 8
#endif
#define BITS_PER_WORD (sizeof(unsigned)*CHAR_BIT)
-#define MAXTABLE 32767
#define WORDSIZE(n) (((n) + BITS_PER_WORD - 1) / BITS_PER_WORD)
#define SETBIT(x, i) ((x)[(i)/BITS_PER_WORD] |= (1<<((i) % BITS_PER_WORD)))
@@ -82,13 +81,13 @@ TC (unsigned *R, int n)
struct pies_depmap
{
- unsigned nrows;
- unsigned rowlen;
+ size_t nrows;
+ size_t rowlen;
unsigned r[1];
};
pies_depmap_t
-depmap_alloc (unsigned count)
+depmap_alloc (size_t count)
{
size_t size = (count + BITS_PER_WORD - 1) / BITS_PER_WORD;
pies_depmap_t dmap = xzalloc (sizeof (*dmap) - 1
@@ -107,20 +106,20 @@ depmap_copy (pies_depmap_t dpm)
}
static unsigned *
-depmap_rowptr (pies_depmap_t dmap, unsigned row)
+depmap_rowptr (pies_depmap_t dmap, size_t row)
{
return dmap->r + dmap->rowlen * row;
}
void
-depmap_set (pies_depmap_t dmap, unsigned row, unsigned col)
+depmap_set (pies_depmap_t dmap, size_t row, size_t col)
{
unsigned *rptr = depmap_rowptr (dmap, row);
SETBIT (rptr, col);
}
int
-depmap_isset (pies_depmap_t dmap, unsigned row, unsigned col)
+depmap_isset (pies_depmap_t dmap, size_t row, size_t col)
{
unsigned *rptr = depmap_rowptr (dmap, row);
return BITISSET (rptr, col);
@@ -135,10 +134,10 @@ depmap_tc (pies_depmap_t dmap)
struct pies_depmap_pos
{
enum pies_depmap_direction dir;
- unsigned coord[2];
+ size_t coord[2];
};
-unsigned
+size_t
depmap_next (pies_depmap_t dmap, pies_depmap_pos_t pos)
{
for (pos->coord[pos->dir]++; pos->coord[pos->dir] < dmap->nrows;
@@ -147,12 +146,12 @@ depmap_next (pies_depmap_t dmap, pies_depmap_pos_t pos)
break;
return pos->coord[pos->dir] == dmap->nrows ?
- (unsigned) -1 : pos->coord[pos->dir];
+ (size_t) -1 : pos->coord[pos->dir];
}
-unsigned
+size_t
depmap_first (pies_depmap_t dmap, enum pies_depmap_direction dir,
- unsigned coord, pies_depmap_pos_t *ppos)
+ size_t coord, pies_depmap_pos_t *ppos)
{
pies_depmap_pos_t pos = xmalloc (sizeof *pos);
*ppos = pos;
diff --git a/src/pies.h b/src/pies.h
index 08a9c4f..b3a13f9 100644
--- a/src/pies.h
+++ b/src/pies.h
@@ -206,14 +206,14 @@ enum pies_depmap_direction
depmap_col = !depmap_row
};
-pies_depmap_t depmap_alloc (unsigned count);
+pies_depmap_t depmap_alloc (size_t count);
pies_depmap_t depmap_copy (pies_depmap_t dpm);
-void depmap_set (pies_depmap_t dmap, unsigned row, unsigned col);
-int depmap_isset (pies_depmap_t dmap, unsigned row, unsigned col);
+void depmap_set (pies_depmap_t dmap, size_t row, size_t col);
+int depmap_isset (pies_depmap_t dmap, size_t row, size_t col);
void depmap_tc (pies_depmap_t dmap);
-unsigned depmap_first (pies_depmap_t dmap, enum pies_depmap_direction dir,
- unsigned coord, pies_depmap_pos_t *ppos);
-unsigned depmap_next (pies_depmap_t dmap, pies_depmap_pos_t pos);
+size_t depmap_first (pies_depmap_t dmap, enum pies_depmap_direction dir,
+ size_t coord, pies_depmap_pos_t *ppos);
+size_t depmap_next (pies_depmap_t dmap, pies_depmap_pos_t pos);
int assert_grecs_value_type (grecs_locus_t *locus,
const grecs_value_t *value, int type);
diff --git a/src/progman.c b/src/progman.c
index 456b5ff..f241915 100644
--- a/src/progman.c
+++ b/src/progman.c
@@ -47,7 +47,7 @@ struct prog
struct
{
struct component *comp;
- unsigned idx; /* Numeric identifier */
+ size_t idx; /* Numeric identifier */
int socket;
struct prog *redir[2]; /* Pointers to redirectors */
time_t timestamp; /* Time of last startup */
@@ -69,7 +69,7 @@ struct prog
#define IS_COMPONENT(p) ((p)->type == TYPE_COMPONENT)
-static unsigned numcomp;
+static size_t numcomp;
static struct prog *proghead, *progtail;
static pies_depmap_t depmap;
static int recompute_alarm;
@@ -944,11 +944,11 @@ void
print_dep (struct prog *prog)
{
pies_depmap_pos_t pos;
- unsigned n;
+ size_t n;
logmsg_printf (LOG_NOTICE, "%s -> ", prog->tag);
for (n = depmap_first (depmap, depmap_col, prog->v.p.idx, &pos);
- n != (unsigned)-1;
+ n != (size_t)-1;
n = depmap_next (depmap, pos))
{
struct prog *dp = prog_lookup_by_idx (n);
@@ -976,16 +976,16 @@ void
progman_dump_depmap ()
{
struct prog *prog;
- unsigned i, j;
+ size_t i, j;
printf ("%s:\n", _("Dependency map"));
printf (" ");
for (i = 0; i < numcomp; i++)
- printf (" %2d", i);
+ printf (" %2lu", (unsigned long)i);
printf ("\n");
for (i = 0; i < numcomp; i++)
{
- printf ("%2d ", i);
+ printf ("%2lu ", (unsigned long)i);
for (j = 0; j < numcomp; j++)
printf (" %c ", depmap_isset (depmap, i, j) ? 'X' : ' ');
printf ("\n");
@@ -995,7 +995,7 @@ progman_dump_depmap ()
{
prog = prog_lookup_by_idx (i);
if (prog)
- printf ("%2d: %s\n", i, prog->tag);
+ printf ("%2d: %s\n", (unsigned long)i, prog->tag);
}
}
@@ -1003,7 +1003,7 @@ int
progman_build_depmap ()
{
int rc = 0;
- unsigned i;
+ size_t i;
struct prog *prog;
pies_depmap_t dp;
@@ -1244,12 +1244,12 @@ void
prog_stop_dependents (struct prog *prog)
{
pies_depmap_pos_t pos;
- unsigned n;
+ size_t n;
int warned = 0;
prog_stop_redirectors (prog);
for (n = depmap_first (depmap, depmap_row, prog->v.p.idx, &pos);
- n != (unsigned)-1;
+ n != (size_t)-1;
n = depmap_next (depmap, pos))
{
struct prog *dp = prog_lookup_by_idx (n);

Return to:

Send suggestions and report system problems to the System administrator.