mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 16:44:49 +01:00
fixed some of the easier clang++ scan-build bugs
git-svn-id: svn://136.177.114.72/svn_GW/phreeqc3/trunk@8908 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
parent
f1438518eb
commit
9f77e000d5
36
PBasic.cpp
36
PBasic.cpp
@ -110,7 +110,7 @@ basic_compile(char *commands, void **lnbase, void **vbase, void **lpbase)
|
||||
}
|
||||
while (!(exitflag || P_eof()));
|
||||
}
|
||||
catch (const PBasicStop& e)
|
||||
catch (const PBasicStop&)
|
||||
{
|
||||
if (P_escapecode != -20)
|
||||
{
|
||||
@ -138,7 +138,7 @@ basic_compile(char *commands, void **lnbase, void **vbase, void **lpbase)
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (const PhreeqcStop& s)
|
||||
catch (const PhreeqcStop&)
|
||||
{
|
||||
// clean up memory
|
||||
disposetokens(&buf);
|
||||
@ -214,7 +214,7 @@ basic_renumber(char *commands, void **lnbase, void **vbase, void **lpbase)
|
||||
}
|
||||
while (!(exitflag || P_eof()));
|
||||
}
|
||||
catch (const PhreeqcStop& e)
|
||||
catch (const PhreeqcStop&)
|
||||
{
|
||||
if (P_escapecode != -20)
|
||||
{
|
||||
@ -279,7 +279,7 @@ basic_run(char *commands, void *lnbase, void *vbase, void *lpbase)
|
||||
}
|
||||
while (!(exitflag || P_eof()));
|
||||
}
|
||||
catch (const PhreeqcStop& e)
|
||||
catch (const PhreeqcStop&)
|
||||
{
|
||||
if (P_escapecode != -20)
|
||||
{
|
||||
@ -355,7 +355,7 @@ basic_main(char *commands)
|
||||
}
|
||||
while (!(exitflag || P_eof()));
|
||||
}
|
||||
catch (const PhreeqcStop& e)
|
||||
catch (const PhreeqcStop&)
|
||||
{
|
||||
if (P_escapecode != -20)
|
||||
{
|
||||
@ -3135,9 +3135,14 @@ factor(struct LOC_exec * LINK)
|
||||
(size_t) (s_v.count_subscripts +
|
||||
1) * sizeof(int));
|
||||
if (s_v.subscripts == NULL)
|
||||
{
|
||||
PhreeqcPtr->malloc_error();
|
||||
s_v.subscripts[s_v.count_subscripts] = i;
|
||||
s_v.count_subscripts++;
|
||||
}
|
||||
else
|
||||
{
|
||||
s_v.subscripts[s_v.count_subscripts] = i;
|
||||
s_v.count_subscripts++;
|
||||
}
|
||||
}
|
||||
|
||||
/* get other subscripts */
|
||||
@ -4866,7 +4871,10 @@ cmdwhile(struct LOC_exec *LINK)
|
||||
|
||||
l = (looprec *) PhreeqcPtr->PHRQ_calloc(1, sizeof(looprec));
|
||||
if (l == NULL)
|
||||
{
|
||||
PhreeqcPtr->malloc_error();
|
||||
return;
|
||||
}
|
||||
l->next = loopbase;
|
||||
loopbase = l;
|
||||
l->kind = whileloop;
|
||||
@ -4969,7 +4977,10 @@ cmdgosub(struct LOC_exec *LINK)
|
||||
|
||||
l = (looprec *) PhreeqcPtr->PHRQ_calloc(1, sizeof(looprec));
|
||||
if (l == NULL)
|
||||
{
|
||||
PhreeqcPtr->malloc_error();
|
||||
return;
|
||||
}
|
||||
l->next = loopbase;
|
||||
loopbase = l;
|
||||
l->kind = gosubloop;
|
||||
@ -5244,9 +5255,14 @@ cmddim(struct LOC_exec *LINK)
|
||||
{
|
||||
v->UU.U0.arr = (LDBLE *) PhreeqcPtr->PHRQ_malloc(j * sizeof(LDBLE));
|
||||
if (v->UU.U0.arr == NULL)
|
||||
{
|
||||
PhreeqcPtr->malloc_error();
|
||||
for (i = 0; i < j; i++)
|
||||
v->UU.U0.arr[i] = 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < j; i++)
|
||||
v->UU.U0.arr[i] = 0.0;
|
||||
}
|
||||
}
|
||||
if (!iseos(LINK))
|
||||
require(tokcomma, LINK);
|
||||
@ -5527,7 +5543,7 @@ exec(void)
|
||||
}
|
||||
while (stmtline != NULL);
|
||||
}
|
||||
catch (const PhreeqcStop& e)
|
||||
catch (const PhreeqcStop)
|
||||
{
|
||||
//_Ltry1:
|
||||
if (P_escapecode == -20)
|
||||
|
||||
@ -795,7 +795,10 @@ get_line(void)
|
||||
error_msg(errstr.str().c_str(), OT_STOP);
|
||||
#endif
|
||||
}
|
||||
this->push_istream(next_stream);
|
||||
else
|
||||
{
|
||||
this->push_istream(next_stream);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3579,7 +3579,10 @@ count_isotope_unknowns(struct inverse *inv_ptr,
|
||||
isotopes =
|
||||
(struct isotope *) PHRQ_malloc((size_t) sizeof(struct isotope));
|
||||
if (isotopes == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
return (0);
|
||||
}
|
||||
count_isotopes = 0;
|
||||
|
||||
for (i = 0; i < inv_ptr->count_isotopes; i++)
|
||||
@ -3615,7 +3618,10 @@ count_isotope_unknowns(struct inverse *inv_ptr,
|
||||
1) *
|
||||
sizeof(struct isotope));
|
||||
if (isotopes == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
return (0);
|
||||
}
|
||||
isotopes[count_isotopes].primary = primary_ptr;
|
||||
isotopes[count_isotopes].master = primary_ptr;
|
||||
isotopes[count_isotopes].isotope_number = isotope_number;
|
||||
@ -3647,7 +3653,10 @@ count_isotope_unknowns(struct inverse *inv_ptr,
|
||||
1) *
|
||||
sizeof(struct isotope));
|
||||
if (isotopes == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
return (0);
|
||||
}
|
||||
isotopes[count_isotopes].primary = primary_ptr;
|
||||
isotopes[count_isotopes].master = master[k];
|
||||
isotopes[count_isotopes].isotope_number = isotope_number;
|
||||
|
||||
5
prep.cpp
5
prep.cpp
@ -2975,6 +2975,7 @@ add_cd_music_factors(int n)
|
||||
error_string = sformatf(
|
||||
"No potential unknown found for surface species %s.", token.c_str());
|
||||
error_msg(error_string, STOP);
|
||||
return (ERROR);
|
||||
}
|
||||
master_ptr = unknown_ptr->master[0]; /* potential for surface component */
|
||||
/*
|
||||
@ -3004,6 +3005,7 @@ add_cd_music_factors(int n)
|
||||
error_string = sformatf(
|
||||
"No potential unknown found for surface species %s.", token.c_str());
|
||||
error_msg(error_string, STOP);
|
||||
return (ERROR);
|
||||
}
|
||||
master_ptr = unknown_ptr->master[0]; /* potential for surface component */
|
||||
/*
|
||||
@ -3023,6 +3025,7 @@ add_cd_music_factors(int n)
|
||||
error_string = sformatf(
|
||||
"No potential unknown found for surface species %s.", token.c_str());
|
||||
error_msg(error_string, STOP);
|
||||
return (ERROR);
|
||||
}
|
||||
master_ptr = unknown_ptr->master[0]; /* potential for surface component */
|
||||
/*
|
||||
@ -3079,6 +3082,7 @@ add_surface_charge_balance(void)
|
||||
error_string = sformatf(
|
||||
"No surface master species found for surface species.");
|
||||
error_msg(error_string, STOP);
|
||||
return(OK);
|
||||
}
|
||||
/*
|
||||
* Find potential unknown for surface species
|
||||
@ -3090,6 +3094,7 @@ add_surface_charge_balance(void)
|
||||
error_string = sformatf(
|
||||
"No potential unknown found for surface species %s.", token.c_str());
|
||||
error_msg(error_string, STOP);
|
||||
return(OK);
|
||||
}
|
||||
master_ptr = unknown_ptr->master[0]; /* potential for surface component */
|
||||
/*
|
||||
|
||||
@ -3557,7 +3557,10 @@ print_alkalinity(void)
|
||||
(struct species_list *)
|
||||
PHRQ_malloc((size_t) (count_s_x * sizeof(struct species_list)));
|
||||
if (alk_list == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
return (OK);
|
||||
}
|
||||
j = 0;
|
||||
for (i = 0; i < count_s_x; i++)
|
||||
{
|
||||
|
||||
44
read.cpp
44
read.cpp
@ -646,7 +646,10 @@ read_exchange_species(void)
|
||||
(struct name_coef *)
|
||||
PHRQ_malloc(sizeof(struct name_coef));
|
||||
if (s_ptr->add_logk == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
return (OK);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -660,7 +663,10 @@ read_exchange_species(void)
|
||||
(struct
|
||||
name_coef)));
|
||||
if (s_ptr->add_logk == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
return (OK);
|
||||
}
|
||||
}
|
||||
/* read name */
|
||||
if (copy_token(token, &next_char, &i) == EMPTY)
|
||||
@ -698,7 +704,10 @@ read_exchange_species(void)
|
||||
(struct name_coef *)
|
||||
PHRQ_malloc(sizeof(struct name_coef));
|
||||
if (s_ptr->add_logk == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
return (OK);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -712,7 +721,10 @@ read_exchange_species(void)
|
||||
(struct
|
||||
name_coef)));
|
||||
if (s_ptr->add_logk == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
return (OK);
|
||||
}
|
||||
}
|
||||
i = sscanf(next_char, SCANFORMAT,
|
||||
&s_ptr->add_logk[s_ptr->count_add_logk].coef);
|
||||
@ -1834,7 +1846,10 @@ read_inv_isotopes(struct inverse *inverse_ptr, char *ptr)
|
||||
1) *
|
||||
sizeof(struct inv_isotope));
|
||||
if (inverse_ptr->i_u == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
return (OK);
|
||||
}
|
||||
inverse_ptr->i_u[inverse_ptr->count_i_u].elt_name = redox_name;
|
||||
inverse_ptr->i_u[inverse_ptr->count_i_u].isotope_number = isotope_number;
|
||||
/*
|
||||
@ -2584,7 +2599,10 @@ read_list_ints(char **ptr, int *count_ints, int positive)
|
||||
(int *) PHRQ_realloc(int_list,
|
||||
(size_t) (*count_ints) * sizeof(int));
|
||||
if (int_list == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
return (NULL);
|
||||
}
|
||||
int_list[(*count_ints) - 1] = value;
|
||||
if (value <= 0 && positive == TRUE)
|
||||
{
|
||||
@ -2632,7 +2650,10 @@ read_list_ints_range(char **ptr, int *count_ints, int positive, int *int_list)
|
||||
{
|
||||
int_list = (int *) PHRQ_malloc(sizeof(int));
|
||||
if (int_list == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
return (NULL);
|
||||
}
|
||||
*count_ints = 0;
|
||||
}
|
||||
ptr_save = *ptr;
|
||||
@ -2646,7 +2667,10 @@ read_list_ints_range(char **ptr, int *count_ints, int positive, int *int_list)
|
||||
(int *) PHRQ_realloc(int_list,
|
||||
(size_t) (*count_ints) * sizeof(int));
|
||||
if (int_list == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
return (NULL);
|
||||
}
|
||||
int_list[(*count_ints) - 1] = value;
|
||||
if (value <= 0 && positive == TRUE)
|
||||
{
|
||||
@ -2687,7 +2711,10 @@ read_list_ints_range(char **ptr, int *count_ints, int positive, int *int_list)
|
||||
(size_t) (*count_ints) *
|
||||
sizeof(int));
|
||||
if (int_list == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
return (NULL);
|
||||
}
|
||||
int_list[(*count_ints) - 1] = i;
|
||||
}
|
||||
}
|
||||
@ -6823,7 +6850,10 @@ read_surface_species(void)
|
||||
(struct name_coef *)
|
||||
PHRQ_malloc(sizeof(struct name_coef));
|
||||
if (s_ptr->add_logk == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
return (OK):
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -6837,7 +6867,10 @@ read_surface_species(void)
|
||||
(struct
|
||||
name_coef)));
|
||||
if (s_ptr->add_logk == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
return (OK):
|
||||
}
|
||||
}
|
||||
/* read name */
|
||||
if (copy_token(token, &next_char, &i) == EMPTY)
|
||||
@ -9190,10 +9223,15 @@ read_rates(void)
|
||||
(size_t) (length + line_length +
|
||||
2) * sizeof(char));
|
||||
if (rate_ptr->commands == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
rate_ptr->commands[length] = ';';
|
||||
rate_ptr->commands[length + 1] = '\0';
|
||||
strcat((rate_ptr->commands), line);
|
||||
}
|
||||
else
|
||||
{
|
||||
rate_ptr->commands[length] = ';';
|
||||
rate_ptr->commands[length + 1] = '\0';
|
||||
strcat((rate_ptr->commands), line);
|
||||
}
|
||||
opt_save = OPT_1;
|
||||
break;
|
||||
}
|
||||
|
||||
3
sit.cpp
3
sit.cpp
@ -792,7 +792,10 @@ Restart:
|
||||
}
|
||||
base = (LDBLE *) PHRQ_malloc((size_t) count_unknowns * sizeof(LDBLE));
|
||||
if (base == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
return OK;
|
||||
}
|
||||
for (i = 0; i < count_unknowns; i++)
|
||||
{
|
||||
base[i] = residual[i];
|
||||
|
||||
52
spread.cpp
52
spread.cpp
@ -345,11 +345,16 @@ read_solution_spread(void)
|
||||
1) *
|
||||
sizeof(struct iso));
|
||||
if (soln_defaults.iso == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
soln_defaults.iso[i].name = string_hsave(token.c_str());
|
||||
soln_defaults.iso[i].value = NAN;
|
||||
soln_defaults.iso[i].uncertainty = NAN;
|
||||
soln_defaults.count_iso++;
|
||||
}
|
||||
else
|
||||
{
|
||||
soln_defaults.iso[i].name = string_hsave(token.c_str());
|
||||
soln_defaults.iso[i].value = NAN;
|
||||
soln_defaults.iso[i].uncertainty = NAN;
|
||||
soln_defaults.count_iso++;
|
||||
}
|
||||
}
|
||||
|
||||
/* read and store isotope ratio uncertainty */
|
||||
@ -418,11 +423,16 @@ read_solution_spread(void)
|
||||
1) *
|
||||
sizeof(struct iso));
|
||||
if (soln_defaults.iso == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
soln_defaults.iso[i].name = string_hsave(token.c_str());
|
||||
soln_defaults.iso[i].value = NAN;
|
||||
soln_defaults.iso[i].uncertainty = NAN;
|
||||
soln_defaults.count_iso++;
|
||||
}
|
||||
else
|
||||
{
|
||||
soln_defaults.iso[i].name = string_hsave(token.c_str());
|
||||
soln_defaults.iso[i].value = NAN;
|
||||
soln_defaults.iso[i].uncertainty = NAN;
|
||||
soln_defaults.count_iso++;
|
||||
}
|
||||
}
|
||||
/* read and store isotope ratio */
|
||||
if (copy_token(token, &next_char) != DIGIT)
|
||||
@ -923,29 +933,44 @@ string_to_spread_row(char *string)
|
||||
/* possible memory error if length of line is smaller than previous line */
|
||||
char *token;
|
||||
char *ptr;
|
||||
struct spread_row *spread_row_ptr;
|
||||
struct spread_row *spread_row_ptr = NULL;
|
||||
/*
|
||||
* Allocate space
|
||||
*/
|
||||
token = (char *) PHRQ_malloc(strlen(line) + 1);
|
||||
if (token == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
return spread_row_ptr;
|
||||
}
|
||||
spread_row_ptr =
|
||||
(struct spread_row *) PHRQ_malloc((size_t) sizeof(struct spread_row));
|
||||
if (spread_row_ptr == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
return spread_row_ptr;
|
||||
}
|
||||
spread_row_ptr->char_vector =
|
||||
(char **) PHRQ_malloc((size_t) spread_length * sizeof(char *));
|
||||
if (spread_row_ptr->char_vector == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
return spread_row_ptr;
|
||||
}
|
||||
spread_row_ptr->d_vector =
|
||||
(LDBLE *) PHRQ_malloc((size_t) spread_length * sizeof(LDBLE));
|
||||
if (spread_row_ptr->d_vector == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
return spread_row_ptr;
|
||||
}
|
||||
spread_row_ptr->type_vector =
|
||||
(int *) PHRQ_malloc((size_t) spread_length * sizeof(int));
|
||||
if (spread_row_ptr->type_vector == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
return spread_row_ptr;
|
||||
}
|
||||
spread_row_ptr->count = 0;
|
||||
spread_row_ptr->empty = 0;
|
||||
spread_row_ptr->string = 0;
|
||||
@ -964,19 +989,28 @@ string_to_spread_row(char *string)
|
||||
(char **) PHRQ_realloc(spread_row_ptr->char_vector,
|
||||
(size_t) spread_length * sizeof(char *));
|
||||
if (spread_row_ptr->char_vector == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
return spread_row_ptr;
|
||||
}
|
||||
|
||||
spread_row_ptr->d_vector =
|
||||
(LDBLE *) PHRQ_realloc(spread_row_ptr->d_vector,
|
||||
(size_t) spread_length * sizeof(LDBLE));
|
||||
if (spread_row_ptr->d_vector == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
return spread_row_ptr;
|
||||
}
|
||||
|
||||
spread_row_ptr->type_vector =
|
||||
(int *) PHRQ_realloc(spread_row_ptr->type_vector,
|
||||
(size_t) spread_length * sizeof(int));
|
||||
if (spread_row_ptr->type_vector == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
return spread_row_ptr;
|
||||
}
|
||||
}
|
||||
j = copy_token_tab(token, &ptr, &l);
|
||||
if (j == EOL)
|
||||
|
||||
55
step.cpp
55
step.cpp
@ -903,26 +903,28 @@ add_reaction(cxxReaction *reaction_ptr, int step_number, LDBLE step_fraction)
|
||||
LDBLE coef = it->second;
|
||||
if (elt_ptr == NULL)
|
||||
{
|
||||
|
||||
assert (false);
|
||||
}
|
||||
master_ptr = elt_ptr->primary;
|
||||
if (master_ptr == NULL)
|
||||
{
|
||||
// error msg has been called in reaction_calc
|
||||
continue;
|
||||
}
|
||||
if (master_ptr->s == s_hplus)
|
||||
{
|
||||
total_h_x += coef * step_x * step_fraction;
|
||||
}
|
||||
else if (master_ptr->s == s_h2o)
|
||||
{
|
||||
total_o_x += coef * step_x * step_fraction;
|
||||
}
|
||||
else
|
||||
{
|
||||
master_ptr->total += coef * step_x * step_fraction;
|
||||
master_ptr = elt_ptr->primary;
|
||||
if (master_ptr == NULL)
|
||||
{
|
||||
// error msg has been called in reaction_calc
|
||||
continue;
|
||||
}
|
||||
if (master_ptr->s == s_hplus)
|
||||
{
|
||||
total_h_x += coef * step_x * step_fraction;
|
||||
}
|
||||
else if (master_ptr->s == s_h2o)
|
||||
{
|
||||
total_o_x += coef * step_x * step_fraction;
|
||||
}
|
||||
else
|
||||
{
|
||||
master_ptr->total += coef * step_x * step_fraction;
|
||||
}
|
||||
}
|
||||
}
|
||||
return (OK);
|
||||
@ -1184,17 +1186,20 @@ add_kinetics(cxxKinetics *kinetics_ptr)
|
||||
it->first.c_str());
|
||||
error_msg(error_string, STOP);
|
||||
}
|
||||
if (master_ptr->s == s_hplus)
|
||||
{
|
||||
total_h_x += coef;
|
||||
}
|
||||
else if (master_ptr->s == s_h2o)
|
||||
{
|
||||
total_o_x += coef;
|
||||
}
|
||||
else
|
||||
{
|
||||
master_ptr->total += coef;
|
||||
if (master_ptr->s == s_hplus)
|
||||
{
|
||||
total_h_x += coef;
|
||||
}
|
||||
else if (master_ptr->s == s_h2o)
|
||||
{
|
||||
total_o_x += coef;
|
||||
}
|
||||
else
|
||||
{
|
||||
master_ptr->total += coef;
|
||||
}
|
||||
}
|
||||
}
|
||||
return (OK);
|
||||
|
||||
@ -727,7 +727,7 @@ inverse_alloc(void)
|
||||
* return: OK
|
||||
*/
|
||||
{
|
||||
struct inverse *inverse_ptr;
|
||||
struct inverse *inverse_ptr = NULL;
|
||||
|
||||
count_inverse++;
|
||||
inverse =
|
||||
@ -735,7 +735,10 @@ inverse_alloc(void)
|
||||
(size_t) count_inverse *
|
||||
sizeof(struct inverse));
|
||||
if (inverse == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
return inverse_ptr;
|
||||
}
|
||||
inverse_ptr = &(inverse[count_inverse - 1]);
|
||||
/*
|
||||
* Initialize variables
|
||||
@ -755,16 +758,25 @@ inverse_alloc(void)
|
||||
inverse_ptr->uncertainties =
|
||||
(LDBLE *) PHRQ_malloc((size_t) sizeof(LDBLE));
|
||||
if (inverse_ptr->uncertainties == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
return inverse_ptr;
|
||||
}
|
||||
|
||||
inverse_ptr->ph_uncertainties =
|
||||
(LDBLE *) PHRQ_malloc((size_t) sizeof(LDBLE));
|
||||
if (inverse_ptr->ph_uncertainties == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
return inverse_ptr;
|
||||
}
|
||||
|
||||
inverse_ptr->force_solns = (int *) PHRQ_malloc((size_t) sizeof(int));
|
||||
if (inverse_ptr->force_solns == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
return inverse_ptr;
|
||||
}
|
||||
|
||||
inverse_ptr->dalk_dph = NULL;
|
||||
inverse_ptr->dalk_dc = NULL;
|
||||
@ -774,7 +786,10 @@ inverse_alloc(void)
|
||||
inverse_ptr->elts =
|
||||
(struct inv_elts *) PHRQ_malloc((size_t) sizeof(struct inv_elts));
|
||||
if (inverse_ptr->elts == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
return inverse_ptr;
|
||||
}
|
||||
inverse_ptr->elts[0].name = NULL;
|
||||
inverse_ptr->elts[0].uncertainties = NULL;
|
||||
|
||||
@ -782,7 +797,10 @@ inverse_alloc(void)
|
||||
(struct inv_isotope *) PHRQ_malloc((size_t)
|
||||
sizeof(struct inv_isotope));
|
||||
if (inverse_ptr->isotopes == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
return inverse_ptr;
|
||||
}
|
||||
inverse_ptr->isotopes[0].isotope_name = NULL;
|
||||
inverse_ptr->isotopes[0].isotope_number = 0;
|
||||
inverse_ptr->isotopes[0].elt_name = NULL;
|
||||
@ -791,7 +809,10 @@ inverse_alloc(void)
|
||||
(struct inv_isotope *) PHRQ_malloc((size_t)
|
||||
sizeof(struct inv_isotope));
|
||||
if (inverse_ptr->i_u == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
return inverse_ptr;
|
||||
}
|
||||
inverse_ptr->i_u[0].isotope_name = NULL;
|
||||
inverse_ptr->i_u[0].isotope_number = 0;
|
||||
inverse_ptr->i_u[0].elt_name = NULL;
|
||||
@ -799,7 +820,10 @@ inverse_alloc(void)
|
||||
inverse_ptr->phases =
|
||||
(struct inv_phases *) PHRQ_malloc((size_t) sizeof(struct inv_phases));
|
||||
if (inverse_ptr->phases == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
return inverse_ptr;
|
||||
}
|
||||
|
||||
return (inverse_ptr);
|
||||
}
|
||||
@ -3612,17 +3636,26 @@ copier_add(struct copier *copier_ptr, int n_user, int start, int end)
|
||||
(int *) PHRQ_realloc(copier_ptr->n_user,
|
||||
(size_t) (copier_ptr->max * sizeof(int)));
|
||||
if (copier_ptr->n_user == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
return (OK);
|
||||
}
|
||||
copier_ptr->start =
|
||||
(int *) PHRQ_realloc(copier_ptr->start,
|
||||
(size_t) (copier_ptr->max * sizeof(int)));
|
||||
if (copier_ptr->start == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
return (OK);
|
||||
}
|
||||
copier_ptr->end =
|
||||
(int *) PHRQ_realloc(copier_ptr->end,
|
||||
(size_t) (copier_ptr->max * sizeof(int)));
|
||||
if (copier_ptr->end == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
return (OK);
|
||||
}
|
||||
}
|
||||
copier_ptr->n_user[copier_ptr->count] = n_user;
|
||||
copier_ptr->start[copier_ptr->count] = start;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user