-
-
Notifications
You must be signed in to change notification settings - Fork 265
Added default initialization to avoid garbage values + extra NULL checks #8964
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2668,6 +2668,8 @@ static void gen_put_segment( const act* action, int column) | |
| args.pat_ident1 = blob->blb_len_ident; | ||
| args.pat_ident2 = blob->blb_buff_ident; | ||
| args.pat_string1 = global_status_name; | ||
| args.pat_long1 = NULL; | ||
| args.pat_long2 = NULL; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Assign |
||
| PATTERN_expand((USHORT) column, pattern1, &args); | ||
|
|
||
| set_sqlcode(action, column); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3368,7 +3368,8 @@ static void gen_t_start( const act* action, int column) | |
|
|
||
| if (trans->tra_db_count == 1) | ||
| { | ||
| printa(column, "%s = %s->startTransaction(%s, %d, fb_tpb_%d);", | ||
| if (trans->tra_tpb) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But what's else? |
||
| printa(column, "%s = %s->startTransaction(%s, %d, fb_tpb_%d);", | ||
| trans->tra_handle ? trans->tra_handle : gpreGlob.transaction_name, | ||
| trans->tra_tpb->tpb_database->dbb_name->sym_string, vector, | ||
| trans->tra_tpb->tpb_length, trans->tra_tpb->tpb_ident); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -364,12 +364,14 @@ void PATTERN_expand( USHORT column, const TEXT* pattern, PAT* args) | |
| break; | ||
|
|
||
| case L1: | ||
| long_value = args->pat_long1; | ||
| if (args && args->pat_long1) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, what's else and why only these two cases? Did you look for cases when |
||
| long_value = args->pat_long1; | ||
| long_flag = true; | ||
| break; | ||
|
|
||
| case L2: | ||
| long_value = args->pat_long2; | ||
| if (args && args->pat_long2) | ||
| long_value = args->pat_long2; | ||
| long_flag = true; | ||
| break; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -458,11 +458,11 @@ bool IntlManager::initialize() | |
| string configInfo; | ||
|
|
||
| const ConfigFile::Parameter* module = ch->sub->findParameter("intl_module"); | ||
| const ConfigFile::Parameter* objModule; | ||
| const ConfigFile::Parameter* objModule = NULL; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| if (module && | ||
| (objModule = configFile.findParameter("intl_module", module->value.c_str()))) | ||
| { | ||
| if (!objModule->sub) | ||
| if (!objModule || !objModule->sub) | ||
| fatal_exception::raiseFmt("Missing parameters for intl_module %s\n", module->value.c_str()); | ||
|
|
||
| const ConfigFile::Parameter* fname = objModule->sub->findParameter("filename"); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1049,6 +1049,9 @@ static Lock* hash_get_lock(Lock* lock, USHORT* hash_slot, Lock*** prior) | |
|
|
||
| // if no collisions found, we're done | ||
|
|
||
| if (!att->att_compatibility_table) | ||
| return NULL; | ||
|
|
||
| Lock* match = (*att->att_compatibility_table)[hash_value]; | ||
| if (!match) | ||
| return NULL; | ||
|
|
@@ -1333,6 +1336,9 @@ static USHORT internal_downgrade(thread_db* tdbb, CheckStatusWrapper* statusVect | |
|
|
||
| // if we can convert to that level, set all identical locks as having that level | ||
|
|
||
| if (!first || !first->lck_physical) | ||
| return NULL; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Meaningful for this case |
||
|
|
||
| if (level < first->lck_physical) | ||
| { | ||
| if (dbb->lockManager()->convert(tdbb, statusVector, first->lck_id, level, LCK_NO_WAIT, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -998,10 +998,12 @@ void Applier::storeBlob(thread_db* tdbb, TraNumber traNum, bid* blobId, | |
| fb_assert(blob->blb_flags & BLB_temporary); | ||
| fb_assert(!(blob->blb_flags & BLB_closed)); | ||
|
|
||
| if (length) | ||
| blob->BLB_put_segment(tdbb, data, length); | ||
| else | ||
| blob->BLB_close(tdbb); | ||
| if (blob){ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bracket on a separate line, please, and writing of a diagnostic to the log in |
||
| if (length) | ||
| blob->BLB_put_segment(tdbb, data, length); | ||
| else | ||
| blob->BLB_close(tdbb); | ||
| } | ||
| } | ||
|
|
||
| void Applier::executeSql(thread_db* tdbb, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually a dead code. The loop above make sure that string is never nullptr if status vector contains strings.