Skip to content

Commit 97f1790

Browse files
authored
Merge pull request #1191 from yasir-hussain-shah/fix/fix-master-warnings
Fix compiler warnings in timing and function removal code
2 parents f9192e6 + 6331511 commit 97f1790

6 files changed

Lines changed: 36 additions & 39 deletions

File tree

contrib/ivorysql_ora/src/builtin_packages/dbms_utility/dbms_utility.c

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -72,28 +72,28 @@ lookup_plisql_functions(void)
7272
lookup_attempted = true;
7373

7474
#ifndef WIN32
75-
/*
76-
* Use RTLD_DEFAULT to search all loaded shared objects.
77-
* plisql.so should already be loaded when these functions are called
78-
* from within a PL/iSQL context.
79-
*/
80-
void *fn;
81-
82-
fn = dlsym(RTLD_DEFAULT, "plisql_get_current_exception_context");
83-
if (fn != NULL)
84-
get_exception_context_fn = (plisql_get_context_fn) fn;
85-
86-
fn = dlsym(RTLD_DEFAULT, "plisql_get_current_exception_message");
87-
if (fn != NULL)
88-
get_exception_message_fn = (plisql_get_message_fn) fn;
89-
90-
fn = dlsym(RTLD_DEFAULT, "plisql_get_current_exception_sqlerrcode");
91-
if (fn != NULL)
92-
get_exception_sqlerrcode_fn = (plisql_get_sqlerrcode_fn) fn;
93-
94-
fn = dlsym(RTLD_DEFAULT, "plisql_get_call_stack");
95-
if (fn != NULL)
96-
get_call_stack_fn = (plisql_get_call_stack_fn) fn;
75+
{
76+
/*
77+
* Use RTLD_DEFAULT to search all loaded shared objects.
78+
* plisql.so should already be loaded when these functions are called
79+
* from within a PL/iSQL context.
80+
*/
81+
void *fn = dlsym(RTLD_DEFAULT, "plisql_get_current_exception_context");
82+
if (fn != NULL)
83+
get_exception_context_fn = (plisql_get_context_fn) fn;
84+
85+
fn = dlsym(RTLD_DEFAULT, "plisql_get_current_exception_message");
86+
if (fn != NULL)
87+
get_exception_message_fn = (plisql_get_message_fn) fn;
88+
89+
fn = dlsym(RTLD_DEFAULT, "plisql_get_current_exception_sqlerrcode");
90+
if (fn != NULL)
91+
get_exception_sqlerrcode_fn = (plisql_get_sqlerrcode_fn) fn;
92+
93+
fn = dlsym(RTLD_DEFAULT, "plisql_get_call_stack");
94+
if (fn != NULL)
95+
get_call_stack_fn = (plisql_get_call_stack_fn) fn;
96+
}
9797
#endif
9898
/* On Windows, function pointers remain NULL - features require plisql */
9999
}

src/backend/executor/nodeResult.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ ExecResult(PlanState *pstate)
104104
*/
105105
if (!node->rs_done)
106106
{
107+
TupleTableSlot *result;
107108
outerPlan = outerPlanState(node);
108109

109110
if (outerPlan != NULL)
@@ -132,7 +133,7 @@ ExecResult(PlanState *pstate)
132133
}
133134

134135
/* form the result tuple using ExecProject(), and return it */
135-
TupleTableSlot *result = ExecProject(node->ps.ps_ProjInfo);
136+
result = ExecProject(node->ps.ps_ProjInfo);
136137

137138
/*
138139
* If the projection contains ROWNUM expressions, materialize

src/backend/utils/adt/varlena.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3994,7 +3994,8 @@ SplitGUCList(char *rawstring, char separator,
39943994
char *new_name;
39953995

39963996
new_name = identifier_case_transform(curname, strlen(curname));
3997-
strncpy(curname, new_name, strlen(new_name));
3997+
memcpy(curname, new_name, strlen(new_name));
3998+
curname[strlen(new_name)] = '\0';
39983999
pfree(new_name);
39994000
}
40004001

src/bin/psql/common.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2860,6 +2860,7 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec)
28602860
int flush_error;
28612861

28622862
*elapsed_msec = 0;
2863+
INSTR_TIME_SET_ZERO(before);
28632864

28642865
/* initialize print options for partial table output */
28652866
my_popt.topt.start_table = true;

src/pl/plisql/src/pl_package.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2730,12 +2730,10 @@ static void
27302730
plisql_remove_function_references(PLiSQL_function *func, PackageCacheItem *item)
27312731
{
27322732
PLiSQL_package *psource = (PLiSQL_package *) item->source;
2733-
int pre_len = list_length(psource->source.funclist);
27342733

2735-
psource->source.funclist = list_delete_ptr(psource->source.funclist, (void *) func);
2736-
2737-
Assert(pre_len == list_length(psource->source.funclist) + 1);
2734+
Assert(list_member_ptr(psource->source.funclist, func));
27382735

2736+
psource->source.funclist = list_delete_ptr(psource->source.funclist, (void *) func);
27392737
psource->source.use_count--;
27402738

27412739
/*
@@ -3638,7 +3636,6 @@ plisql_subproc_should_change_return_type(FuncExpr *fexpr,
36383636
{
36393637
/* only one out-parameter, change the rettype to be out-parameter type */
36403638
ListCell *lc;
3641-
bool found = false;
36423639

36433640
foreach (lc, subprocfunc->arg)
36443641
{
@@ -3647,15 +3644,14 @@ plisql_subproc_should_change_return_type(FuncExpr *fexpr,
36473644
if (argitem->argmode == ARGMODE_OUT ||
36483645
argitem->argmode == ARGMODE_INOUT)
36493646
{
3650-
found = true;
36513647
result = true;
36523648
*rettype = argitem->type->typoid;
36533649
*typmod = argitem->type->atttypmod;
36543650
*collationoid = argitem->type->collation;
36553651
break;
36563652
}
36573653
}
3658-
Assert(found);
3654+
Assert(result);
36593655
}
36603656
return result;
36613657
}

src/pl/plisql/src/pl_subproc_function.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3024,7 +3024,6 @@ plisql_dynamic_compile_subproc(FunctionCallInfo fcinfo,
30243024
static void
30253025
plsql_init_glovalvar_from_stack(PLiSQL_execstate * estate, int dno, int *start_level)
30263026
{
3027-
bool match = false;
30283027
int connected;
30293028
PLiSQL_execstate *parestate;
30303029
PLiSQL_function *func;
@@ -3042,11 +3041,11 @@ plsql_init_glovalvar_from_stack(PLiSQL_execstate * estate, int dno, int *start_l
30423041
if (dno >= parestate->ndatums)
30433042
continue;
30443043
plisql_assign_in_global_var(estate, parestate, dno);
3045-
match = true;
30463044
*start_level = connected;
3047-
break;
3045+
3046+
return;
30483047
}
3049-
Assert(match);
3048+
Assert(false);
30503049
return;
30513050
}
30523051

@@ -3056,7 +3055,6 @@ plsql_init_glovalvar_from_stack(PLiSQL_execstate * estate, int dno, int *start_l
30563055
static void
30573056
plsql_assign_out_glovalvar_from_stack(PLiSQL_execstate * estate, int dno, int *start_level)
30583057
{
3059-
bool match = false;
30603058
int connected;
30613059
PLiSQL_execstate *parestate;
30623060
PLiSQL_function *func;
@@ -3075,10 +3073,10 @@ plsql_assign_out_glovalvar_from_stack(PLiSQL_execstate * estate, int dno, int *s
30753073
continue;
30763074
plisql_assign_out_global_var(estate, parestate, dno, connected);
30773075
*start_level = connected;
3078-
match = true;
3079-
break;
3076+
3077+
return;
30803078
}
3081-
Assert(match);
3079+
Assert(false);
30823080
return;
30833081
}
30843082

0 commit comments

Comments
 (0)