MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / SDLTest_RandomAsciiStringOfSize

Function SDLTest_RandomAsciiStringOfSize

deps/SDL2/src/test/SDL_test_fuzzer.c:506–532  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

504}
505
506char *
507SDLTest_RandomAsciiStringOfSize(int size)
508{
509 char *string;
510 int counter;
511
512
513 if(size < 1) {
514 SDL_InvalidParamError("size");
515 return NULL;
516 }
517
518 string = (char *)SDL_malloc((size + 1) * sizeof(char));
519 if (string==NULL) {
520 return NULL;
521 }
522
523 for(counter = 0; counter < size; ++counter) {
524 string[counter] = (char)SDLTest_RandomIntegerInRange(32, 126);
525 }
526
527 string[counter] = '\0';
528
529 fuzzerInvocationCounter++;
530
531 return string;
532}
533
534/* vi: set ts=4 sw=4 expandtab: */

Calls 2

SDL_mallocFunction · 0.85

Tested by

no test coverage detected