Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#2 min.max.total operators

closed-rejected
None
5
2000-07-04
2000-06-22
henry Butowsky
No

Discussion

  • henry Butowsky
    henry Butowsky
    2000-06-22

    None

     
    Attachments
  • Charlie Zender
    Charlie Zender
    2000-06-23

    Thanks!
    The patch looks good so far and just needs a little more work
    before I apply it:

    -y is fine for now.

    Add some comments to var_copy() describing how it differs
    from var_dup() and describing when its use is appropriate.

    Use memcpy() in var_copy()

    make all the minmax stuff work with a new enumerated type
    so we see descriptive labels instead of 0,1,2...
    enum nco_op_typ{
    nco_op_avg,
    nco_op_min,
    nco_op_max,
    nco_op_ttl
    }; /* end enum */
    and change "minmax" to op_typ or something more inclusive
    of other types of operations than min and max.

    Add this comment to var_min() and var_max() because without
    it I always get confused:
    /* NB: it is not neccessary to un-typecast pointers to values after access
    because we have only operated on local copies of them. */

    This following snippet looks like it may be duplicated between ncra and ncea:

    switch (opt_minmax){
    case 0: /* averages */
    (void)var_add(var_prc_out[idx]->type,var_prc_out[idx]->sz,var_prc[idx]->has_mss_val,var_prc[idx]->mss_val,var_prc[idx]->tally,var_prc[idx]->val,var_prc_out[idx]->val);
    break;
    case 1: /* minimum */
    /* on the first loop simply copy variables from var_prc to var_prc_out */
    if (idx_fl == 0 && idx == 0) (void)var_copy(var_prc[idx]->type,var_prc[idx]->sz,var_prc[idx]->val,var_prc_out[idx]->val); else
    ...
    break;
    } /* end switch */

    I did not check carefully if it is actually slightly different, in which case
    your patch is fine. If they are the same it would sure be nice to move this
    switch() statement to its own function because ncra.c is already fairly
    messy and we don't want to duplicate code if we can make a common function.
    Comments?

     
  • Charlie Zender
    Charlie Zender
    2000-06-23

    • assigned_to: nobody --> zender
     
  • Charlie Zender
    Charlie Zender
    2000-07-04

    • status: open-rejected --> closed-rejected