[crush-tools] r529 committed - * fixup a little aggregate: preserve mix, max labels, fix max lable.

2 views
Skip to first unread message

crush...@googlecode.com

unread,
Mar 15, 2013, 10:35:51 PM3/15/13
to crush...@googlegroups.com
Revision: 529
Author: warlock.cc
Date: Fri Mar 15 19:35:38 2013
Log: * fixup a little aggregate: preserve mix, max labels, fix max
lable.

http://code.google.com/p/crush-tools/source/detail?r=529

Modified:
/trunk/src/aggregate/aggregate.c

=======================================
--- /trunk/src/aggregate/aggregate.c Wed Apr 13 06:59:37 2011
+++ /trunk/src/aggregate/aggregate.c Fri Mar 15 19:35:38 2013
@@ -92,6 +92,7 @@
conf->mins.count = expand_label_list(args->min_labels, header, delim,
&(conf->mins.indexes),
&(conf->mins.size));
+ args->preserve = 1;
}
if (conf->mins.count < 0) {
return conf->mins.count;
@@ -107,25 +108,25 @@
conf->maxs.count = expand_label_list(args->max_labels, header, delim,
&(conf->maxs.indexes),
&(conf->maxs.size));
+ args->preserve = 1;
}
if (conf->maxs.count < 0) {
return conf->maxs.count;
} else if (conf->maxs.count > 0) {
decrement_values(conf->maxs.indexes, conf->maxs.count);
- conf->maxs.precisions = xmalloc(sizeof(int) * conf->maxs.count);
- memset(conf->maxs.precisions, 0, sizeof(int) * conf->maxs.count);
+ conf->maxs.precisions = xcalloc(conf->maxs.count, sizeof(int));
}

return 0;
}

-/** @brief
- *
+/** @brief
+ *
* @param args contains the parsed cmd-line options & arguments.
* @param argc number of cmd-line arguments.
* @param argv list of cmd-line arguments
* @param optind index of the first non-option cmd-line argument.
- *
+ *
* @return exit status for main() to return.
*/
int aggregate(struct cmdargs *args, int argc, char *argv[], int optind) {
@@ -249,7 +250,7 @@
if (conf.maxs.count) {
extract_fields_to_string(in_reader->current_line, outbuf,
outbuf_sz,
conf.maxs.indexes, conf.maxs.count, delim,
- args->auto_label ? "-Min" : NULL);
+ args->auto_label ? "-Max" : NULL);
printf("%s%s", delim, outbuf);
}
}
@@ -258,7 +259,6 @@
}

ht_init(&aggregations, 1024, NULL, (void (*)) free_agg);
- /* ht_init( &aggregations, 1024, NULL, free ); */

n_hash_elems = 0;

@@ -385,6 +385,8 @@
dbfr_getline(in_reader);
}
}
+
+ free(outbuf);

/* Print all of the output. */
key_array = xmalloc(sizeof(char *) * n_hash_elems);
Reply all
Reply to author
Forward
0 new messages