mirror of
https://gitlab.gnome.org/GNOME/libxslt
synced 2025-07-29 15:41:13 +03:00
Initialize pseudo random number generator with current time or optional command line parameter
This commit is contained in:
committed by
Daniel Veillard
parent
90e8b9066d
commit
3fcf11ead6
@ -514,6 +514,7 @@ static void usage(const char *name) {
|
||||
printf("\t--maxdepth val : increase the maximum depth (default %d)\n", xsltMaxDepth);
|
||||
printf("\t--maxvars val : increase the maximum variables (default %d)\n", xsltMaxVars);
|
||||
printf("\t--maxparserdepth val : increase the maximum parser depth\n");
|
||||
printf("\t--seed-rand val : initialize pseudo random number generator with specific seed\n");
|
||||
#ifdef LIBXML_HTML_ENABLED
|
||||
printf("\t--html: the input document is(are) an HTML file(s)\n");
|
||||
#endif
|
||||
@ -556,6 +557,7 @@ main(int argc, char **argv)
|
||||
return (1);
|
||||
}
|
||||
|
||||
srand(time(NULL));
|
||||
xmlInitMemory();
|
||||
|
||||
LIBXML_TEST_VERSION
|
||||
@ -750,6 +752,15 @@ main(int argc, char **argv)
|
||||
if (value > 0)
|
||||
xmlParserMaxDepth = value;
|
||||
}
|
||||
} else if ((!strcmp(argv[i], "-seed-rand")) ||
|
||||
(!strcmp(argv[i], "--seed-rand"))) {
|
||||
int value;
|
||||
|
||||
i++;
|
||||
if (sscanf(argv[i], "%d", &value) == 1) {
|
||||
if (value > 0)
|
||||
srand(value);
|
||||
}
|
||||
} else if ((!strcmp(argv[i],"-dumpextensions"))||
|
||||
(!strcmp(argv[i],"--dumpextensions"))) {
|
||||
dumpextensions++;
|
||||
@ -786,6 +797,10 @@ main(int argc, char **argv)
|
||||
(!strcmp(argv[i], "--maxparserdepth"))) {
|
||||
i++;
|
||||
continue;
|
||||
} else if ((!strcmp(argv[i], "-seed-rand")) ||
|
||||
(!strcmp(argv[i], "--seed-rand"))) {
|
||||
i++;
|
||||
continue;
|
||||
} else if ((!strcmp(argv[i], "-o")) ||
|
||||
(!strcmp(argv[i], "-output")) ||
|
||||
(!strcmp(argv[i], "--output"))) {
|
||||
|
Reference in New Issue
Block a user