/[pspp]/pspp/src/autorecode.c
ViewVC logotype

Diff of /pspp/src/autorecode.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.20 by blp, Sun Jul 31 21:42:46 2005 UTC revision 1.21 by blp, Mon Oct 24 02:51:32 2005 UTC
# Line 58  struct autorecode_trns Line 58  struct autorecode_trns
58      struct trns_header h;      struct trns_header h;
59      struct pool *owner;         /* Contains AUTORECODE specs. */      struct pool *owner;         /* Contains AUTORECODE specs. */
60      struct arc_spec *specs;     /* AUTORECODE specifications. */      struct arc_spec *specs;     /* AUTORECODE specifications. */
61      int spec_cnt;               /* Number of specifications. */      size_t spec_cnt;            /* Number of specifications. */
62    };    };
63    
64  /* Descending or ascending sort order. */  /* Descending or ascending sort order. */
# Line 75  struct autorecode_pgm Line 75  struct autorecode_pgm
75      char **dst_names;              /* Target variable names. */      char **dst_names;              /* Target variable names. */
76      struct variable **dst_vars;    /* Target variables. */      struct variable **dst_vars;    /* Target variables. */
77      struct hsh_table **src_values; /* `union value's of source vars. */      struct hsh_table **src_values; /* `union value's of source vars. */
78      int var_cnt;                   /* Number of variables. */      size_t var_cnt;                /* Number of variables. */
79      struct pool *src_values_pool;  /* Pool used by src_values. */      struct pool *src_values_pool;  /* Pool used by src_values. */
80      enum direction direction;      /* Sort order. */      enum direction direction;      /* Sort order. */
81      int print;                     /* Print mapping table if nonzero. */      int print;                     /* Print mapping table if nonzero. */
# Line 95  int Line 95  int
95  cmd_autorecode (void)  cmd_autorecode (void)
96  {  {
97    struct autorecode_pgm arc;    struct autorecode_pgm arc;
98    int dst_cnt;    size_t dst_cnt;
99    int i;    size_t i;
100    
101    arc.src_vars = NULL;    arc.src_vars = NULL;
102    arc.dst_names = NULL;    arc.dst_names = NULL;
# Line 120  cmd_autorecode (void) Line 120  cmd_autorecode (void)
120      goto lossage;      goto lossage;
121    if (dst_cnt != arc.var_cnt)    if (dst_cnt != arc.var_cnt)
122      {      {
123        int i;        size_t i;
124    
125        msg (SE, _("Source variable count (%d) does not match "        msg (SE, _("Source variable count (%u) does not match "
126                   "target variable count (%d)."), arc.var_cnt, dst_cnt);                   "target variable count (%u)."),
127               (unsigned) arc.var_cnt, (unsigned) dst_cnt);
128    
129        for (i = 0; i < dst_cnt; i++)        for (i = 0; i < dst_cnt; i++)
130          free (arc.dst_names[i]);          free (arc.dst_names[i]);
# Line 197  arc_free (struct autorecode_pgm *arc) Line 198  arc_free (struct autorecode_pgm *arc)
198    free (arc->src_vars);    free (arc->src_vars);
199    if (arc->dst_names != NULL)    if (arc->dst_names != NULL)
200      {      {
201        int i;        size_t i;
202                
203        for (i = 0; i < arc->var_cnt; i++)        for (i = 0; i < arc->var_cnt; i++)
204          free (arc->dst_names[i]);          free (arc->dst_names[i]);
# Line 206  arc_free (struct autorecode_pgm *arc) Line 207  arc_free (struct autorecode_pgm *arc)
207    free (arc->dst_vars);    free (arc->dst_vars);
208    if (arc->src_values != NULL)    if (arc->src_values != NULL)
209      {      {
210        int i;        size_t i;
211    
212        for (i = 0; i < arc->var_cnt; i++)        for (i = 0; i < arc->var_cnt; i++)
213          hsh_destroy (arc->src_values[i]);          hsh_destroy (arc->src_values[i]);
# Line 223  recode (const struct autorecode_pgm *arc Line 224  recode (const struct autorecode_pgm *arc
224  {  {
225    struct autorecode_trns *t;    struct autorecode_trns *t;
226    struct pool *pool;    struct pool *pool;
227    int i;    size_t i;
228    
229    pool = pool_create ();    pool = pool_create ();
230    t = xmalloc (sizeof *t);    t = xmalloc (sizeof *t);
# Line 270  autorecode_trns_proc (struct trns_header Line 271  autorecode_trns_proc (struct trns_header
271                        int case_idx UNUSED)                        int case_idx UNUSED)
272  {  {
273    struct autorecode_trns *t = (struct autorecode_trns *) trns;    struct autorecode_trns *t = (struct autorecode_trns *) trns;
274    int i;    size_t i;
275    
276    for (i = 0; i < t->spec_cnt; i++)    for (i = 0; i < t->spec_cnt; i++)
277      {      {
# Line 293  static void Line 294  static void
294  autorecode_trns_free (struct trns_header * trns)  autorecode_trns_free (struct trns_header * trns)
295  {  {
296    struct autorecode_trns *t = (struct autorecode_trns *) trns;    struct autorecode_trns *t = (struct autorecode_trns *) trns;
297    int i;    size_t i;
298    
299    for (i = 0; i < t->spec_cnt; i++)    for (i = 0; i < t->spec_cnt; i++)
300      hsh_destroy (t->specs[i].items);      hsh_destroy (t->specs[i].items);
# Line 342  static int Line 343  static int
343  autorecode_proc_func (struct ccase *c, void *arc_)  autorecode_proc_func (struct ccase *c, void *arc_)
344  {  {
345    struct autorecode_pgm *arc = arc_;    struct autorecode_pgm *arc = arc_;
346    int i;    size_t i;
347    
348    for (i = 0; i < arc->var_cnt; i++)    for (i = 0; i < arc->var_cnt; i++)
349      {      {

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.21

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26