mirror of
https://github.com/johnkerl/miller.git
synced 2026-07-20 18:10:07 +00:00
neaten
This commit is contained in:
parent
7c4219f5df
commit
f2c005152e
6 changed files with 3 additions and 10 deletions
|
|
@ -13,7 +13,6 @@ mlr_dsl_ast_node_t* mlr_dsl_ast_node_alloc(char* text, int type) {
|
|||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
// xxx rename to ..._terminal to make it clear that children aren't copied.
|
||||
mlr_dsl_ast_node_t* mlr_dsl_ast_node_copy(mlr_dsl_ast_node_t* pother) {
|
||||
mlr_dsl_ast_node_t* pnode = mlr_dsl_ast_node_alloc(pother->text, pother->type);
|
||||
return pnode;
|
||||
|
|
|
|||
|
|
@ -53,10 +53,10 @@ static int compute_index(int n, double p) {
|
|||
index = 0;
|
||||
else if (index >= n)
|
||||
index = n-1;
|
||||
// xxx need to try harder on round-up/round-down cases?
|
||||
return index;
|
||||
}
|
||||
|
||||
// See also https://github.com/johnkerl/miller/issues/14 which requests an interpolation option.
|
||||
double percentile_keeper_emit(percentile_keeper_t* ppercentile_keeper, double percentile) {
|
||||
if (!ppercentile_keeper->sorted) {
|
||||
qsort(ppercentile_keeper->data, ppercentile_keeper->size, sizeof(double), double_comparator);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
// ----------------------------------------------------------------
|
||||
top_keeper_t* top_keeper_alloc(int capacity) {
|
||||
top_keeper_t* ptop_keeper = mlr_malloc_or_die(sizeof(top_keeper_t));
|
||||
// xxx mk func for neg-cap check; use here & elsewhere
|
||||
ptop_keeper->top_values = mlr_malloc_or_die(capacity*sizeof(double));
|
||||
ptop_keeper->top_precords = mlr_malloc_or_die(capacity*sizeof(lrec_t*));
|
||||
ptop_keeper->size = 0;
|
||||
|
|
|
|||
|
|
@ -50,12 +50,12 @@ static sllv_t* mapper_having_fields_which_are_process(lrec_t* pinrec, context_t*
|
|||
// ----------------------------------------------------------------
|
||||
static sllv_t* mapper_having_fields_at_most_process(lrec_t* pinrec, context_t* pctx, void* pvstate) {
|
||||
if (pinrec == NULL)
|
||||
return sllv_single(NULL); // xxx cmt all of these, in all mappers
|
||||
return sllv_single(NULL);
|
||||
mapper_having_fields_state_t* pstate = (mapper_having_fields_state_t*)pvstate;
|
||||
for (lrece_t* pe = pinrec->phead; pe != NULL; pe = pe->pnext) {
|
||||
if (!hss_has(pstate->pfield_name_set, pe->key)) {
|
||||
lrec_free(pinrec);
|
||||
return NULL; // xxx cmt all of these, in all mappers
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return sllv_single(pinrec);
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ static void mapper_put_free(void* pvstate) {
|
|||
free(pstate->pevaluators);
|
||||
}
|
||||
|
||||
// xxx comment me ...
|
||||
static mapper_t* mapper_put_alloc(sllv_t* pasts) {
|
||||
mapper_put_state_t* pstate = mlr_malloc_or_die(sizeof(mapper_put_state_t));
|
||||
pstate->num_evaluators = pasts->length;
|
||||
|
|
|
|||
|
|
@ -82,7 +82,6 @@ int mt_get_boolean_strict(mv_t* pval) {
|
|||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
// xxx check for semantics comparable to mt_get_boolean_strict
|
||||
void mt_get_double_strict(mv_t* pval) {
|
||||
if (pval->type == MT_NULL)
|
||||
return;
|
||||
|
|
@ -112,7 +111,6 @@ void mt_get_double_strict(mv_t* pval) {
|
|||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
// xxx merge with mt_get_double_string w/ a nullable parameter
|
||||
void mt_get_double_nullable(mv_t* pval) {
|
||||
if (pval->type == MT_NULL)
|
||||
return;
|
||||
|
|
@ -192,7 +190,6 @@ mv_t s_sss_sub_func(mv_t* pval1, mv_t* pval2, mv_t* pval3) {
|
|||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
// xxx cmt mem-mgt & contract. similar to lrec-mapper contract.
|
||||
mv_t s_s_tolower_func(mv_t* pval1) {
|
||||
char* string = mlr_strdup_or_die(pval1->u.strv);
|
||||
for (char* c = string; *c; c++)
|
||||
|
|
@ -204,7 +201,6 @@ mv_t s_s_tolower_func(mv_t* pval1) {
|
|||
return rv;
|
||||
}
|
||||
|
||||
// xxx cmt mem-mgt & contract. similar to lrec-mapper contract.
|
||||
mv_t s_s_toupper_func(mv_t* pval1) {
|
||||
char* string = mlr_strdup_or_die(pval1->u.strv);
|
||||
for (char* c = string; *c; c++)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue