Skip to content

Commit

Permalink
Remove unused functions from utils.c
Browse files Browse the repository at this point in the history
Remove int_cmp, create_fmgr and makeRangeVarFromRelid from utils.c
since they were not used and had no test coverage.
  • Loading branch information
svenklemm authored and RobAtticus committed Dec 4, 2018
1 parent 966ffd6 commit 79bee23
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 45 deletions.
42 changes: 0 additions & 42 deletions src/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,48 +207,6 @@ time_value_to_internal(Datum time_val, Oid type_oid, bool failure_ok)
}
}

/* Make a RangeVar from a regclass Oid */
RangeVar *
makeRangeVarFromRelid(Oid relid)
{
Oid namespace = get_rel_namespace(relid);
char *tableName = get_rel_name(relid);
char *schemaName = get_namespace_name(namespace);

return makeRangeVar(schemaName, tableName, -1);
}

int
int_cmp(const void *a, const void *b)
{
const int *ia = (const int *) a;
const int *ib = (const int *) b;

return *ia - *ib;
}

FmgrInfo *
create_fmgr(char *schema, char *function_name, int num_args)
{
FmgrInfo *finfo = palloc(sizeof(FmgrInfo));
FuncCandidateList func_list = FuncnameGetCandidates(list_make2(makeString(schema),
makeString(function_name)),
num_args, NULL, false, false, false);

if (func_list == NULL)
{
elog(ERROR, "could not find the function \"%s.%s\"", schema, function_name);
}
if (func_list->next != NULL)
{
elog(ERROR, "multiple functions found");
}

fmgr_info(func_list->oid, finfo);

return finfo;
}

/* Returns approximate period in microseconds */
int64
get_interval_period_approx(Interval *interval)
Expand Down
3 changes: 0 additions & 3 deletions src/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ extern int64 date_trunc_interval_period_approx(text *units);
*/
extern int64 get_interval_period_approx(Interval *interval);

extern FmgrInfo *create_fmgr(char *schema, char *function_name, int num_args);
extern RangeVar *makeRangeVarFromRelid(Oid relid);
extern int int_cmp(const void *a, const void *b);
extern Oid inheritance_parent_relid(Oid relid);

void *create_struct_from_tuple(HeapTuple tuple, MemoryContext mctx, size_t alloc_size, size_t copy_size);
Expand Down

0 comments on commit 79bee23

Please sign in to comment.