Apply changes suggested by scan-build static analyzer and pgindent

This commit is contained in:
Matvey Arye 2017-09-06 16:58:26 -04:00 committed by Matvey Arye
parent d2561cc4fd
commit 98cc8a84f6
6 changed files with 15 additions and 6 deletions

View File

@ -59,5 +59,6 @@ chunk_dispatch_get_chunk_insert_state(ChunkDispatch *dispatch, Point *point)
subspace_store_add(dispatch->cache, new_chunk->cube, cis, destroy_chunk_insert_state);
}
Assert(cis != NULL);
return cis;
}

View File

@ -248,6 +248,8 @@ timescaledb_CopyFrom(CopyState cstate, Relation main_rel, List *range_table, Hyp
/* Find or create the insert state matching the point */
cis = chunk_dispatch_get_chunk_insert_state(dispatch, point);
Assert(cis != NULL);
if (cis != prev_cis)
{
/* Different chunk so must release BulkInsertState */

View File

@ -25,7 +25,6 @@ dimension_slice_from_form_data(Form_dimension_slice fd)
{
DimensionSlice *slice = dimension_slice_alloc();
slice = palloc0(sizeof(DimensionSlice));
memcpy(&slice->fd, fd, sizeof(FormData_dimension_slice));
slice->storage_free = NULL;
slice->storage = NULL;

View File

@ -94,7 +94,7 @@ dimension_vec_add_slice(DimensionVec **vecptr, DimensionSlice *slice)
DimensionVec *
dimension_vec_add_slice_sort(DimensionVec **vecptr, DimensionSlice *slice)
{
DimensionVec *vec = *vecptr;
DimensionVec *vec;
*vecptr = vec = dimension_vec_add_slice(vecptr, slice);
return dimension_vec_sort(vecptr);

View File

@ -7,7 +7,8 @@
static void plantree_walker(Plan **plan, void (*walker) (Plan **, void *), void *ctx);
static inline void
plantree_walk_subplans(List *plans, void (*walker) (Plan **, void *), void *ctx)
plantree_walk_subplans(List *plans,
void (*walker) (Plan **, void *), void *ctx)
{
ListCell *lc;
@ -21,7 +22,9 @@ plantree_walk_subplans(List *plans, void (*walker) (Plan **, void *), void *ctx)
/* A plan tree walker. Similar to planstate_tree_walker in PostgreSQL's
* nodeFuncs.c, but this walks a Plan tree as opposed to a PlanState tree. */
static void
plantree_walker(Plan **planptr, void (*walker) (Plan **, void *), void *context)
plantree_walker(Plan **planptr,
void (*walker) (Plan **, void *),
void *context)
{
Plan *plan = *planptr;
@ -64,7 +67,9 @@ plantree_walker(Plan **planptr, void (*walker) (Plan **, void *), void *context)
}
void
planned_stmt_walker(PlannedStmt *stmt, void (*walker) (Plan **, void *), void *context)
planned_stmt_walker(PlannedStmt *stmt,
void (*walker) (Plan **, void *),
void *context)
{
ListCell *lc;

View File

@ -67,6 +67,7 @@ subspace_store_add(SubspaceStore *store, const Hypercube *hc,
if (vec == NULL)
{
Assert(last != NULL);
last->storage = subspace_store_dimension_create();
last->storage_free = subspace_store_free_internal_node;
vec = last->storage;
@ -103,7 +104,7 @@ subspace_store_add(SubspaceStore *store, const Hypercube *hc,
vecptr = (DimensionVec **) &last->storage;
}
Assert(last->storage == NULL);
Assert(last != NULL && last->storage == NULL);
last->storage = object; /* at the end we store the object */
last->storage_free = object_free;
MemoryContextSwitchTo(old);
@ -128,6 +129,7 @@ subspace_store_get(SubspaceStore *store, Point *target)
vec = match->storage;
}
Assert(match != NULL);
return match->storage;
}