[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pspp-cvs] pspp/src regression.q regression_export.h
From: |
Jason H Stover |
Subject: |
[Pspp-cvs] pspp/src regression.q regression_export.h |
Date: |
Sun, 01 Jan 2006 16:47:06 +0000 |
CVSROOT: /sources/pspp
Module name: pspp
Branch:
Changes by: Jason H Stover <address@hidden> 06/01/01 16:47:06
Modified files:
src : regression.q regression_export.h
Log message:
Substituted strncmp for strcmp to limit string size
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/regression.q.diff?tr1=1.30&tr2=1.31&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/regression_export.h.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
Patches:
Index: pspp/src/regression.q
diff -u pspp/src/regression.q:1.30 pspp/src/regression.q:1.31
--- pspp/src/regression.q:1.30 Sun Jan 1 00:03:51 2006
+++ pspp/src/regression.q Sun Jan 1 16:47:06 2006
@@ -558,7 +558,7 @@
fprintf (fp, "int i;\n\tint n_vars = %d;\n\t",c->n_indeps);
reg_print_depvars (fp, c);
fprintf (fp, "for (i = 0; i < n_vars; i++)\n\t{\n\t\t");
- fprintf (fp, "if (strcmp (v_name, model_depvars[i]) == 0)\n\t\t{\n\t\t\t");
+ fprintf (fp, "if (strncmp (v_name, model_depvars[i], PSPP_REG_MAXLEN) ==
0)\n\t\t{\n\t\t\t");
fprintf (fp, "return i;\n\t\t}\n\t}\n}\n");
}
static void
@@ -579,7 +579,6 @@
assert (fp != NULL);
fp = fopen (handle_get_filename (model_file), "w");
fprintf (fp, "%s", reg_preamble);
- fprintf (fp, "#include <string.h>\n#include <math.h>\n\n");
reg_print_getvar (fp, c);
reg_print_categorical_encoding (fp, c);
fprintf (fp, "%s", reg_export_t_quantiles_1);
Index: pspp/src/regression_export.h
diff -u pspp/src/regression_export.h:1.3 pspp/src/regression_export.h:1.4
--- pspp/src/regression_export.h:1.3 Sun Jan 1 00:04:03 2006
+++ pspp/src/regression_export.h Sun Jan 1 16:47:06 2006
@@ -39,7 +39,8 @@
const char reg_preamble[] = "/*\n This program contains functions which
return estimates\n"
" and confidence intervals for a linear model. The EXPORT subcommand\n"
-" of the REGRESSION procedure of GNU PSPP generated this program.\n*/\n\n";
+" of the REGRESSION procedure of GNU PSPP generated this program.\n*/\n\n"
+"#include <string.h>\n#include <math.h>\n#define PSPP_REG_MAXLEN 1024\n\n";
const char reg_mean_cmt[] = "/*\n Estimate the mean of Y, the dependent
variable for\n"
" the linear model of the form \n\n"
@@ -138,10 +139,10 @@
"int i;\n\t";
const char reg_export_categorical_encode_2[] = "int v_index = 0;\n\t"
-"while (v_index < n_vars && strcmp (var, varlist[i]->name) != 0)\n\t{\n\t\t"
+"while (v_index < n_vars && strncmp (var, varlist[i]->name, PSPP_REG_MAXLEN)
!= 0)\n\t{\n\t\t"
"v_index++;\n\t}\n\tresult = (double *) malloc (varlist[v_index]->n_vals *
sizeof (*result));\n\t"
"for (i = 0; i < varlist[v_index]->n_vals; i++)\n\t{\n\t\t"
-"if (strcmp ( (varlist[v_index]->values)[i], value) == 0)\n\t\t{\n\t\t\t"
+"if (strncmp ( (varlist[v_index]->values)[i], value, PSPP_REG_MAXLEN) ==
0)\n\t\t{\n\t\t\t"
"result[i] = 1.0;\n\t\t}\n\t\telse result[i] = 0.0;\n\t}\n\n\t"
"return result;\n}\n\n";
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pspp-cvs] pspp/src regression.q regression_export.h,
Jason H Stover <=