src/stdlib/SDL_getenv.c
changeset 11232 b26929d6ca20
parent 10737 3406a0f8b041
equal deleted inserted replaced
11231:5235df1ce071 11232:b26929d6ca20
    58     if (!name || SDL_strlen(name) == 0 || SDL_strchr(name, '=') != NULL || !value) {
    58     if (!name || SDL_strlen(name) == 0 || SDL_strchr(name, '=') != NULL || !value) {
    59         return (-1);
    59         return (-1);
    60     }
    60     }
    61     
    61     
    62     if (!overwrite) {
    62     if (!overwrite) {
    63         char ch = 0;
    63         if (GetEnvironmentVariableA(name, NULL, 0) > 0) {
    64         const size_t len = GetEnvironmentVariableA(name, &ch, sizeof (ch));
       
    65         if (len > 0) {
       
    66             return 0;  /* asked not to overwrite existing value. */
    64             return 0;  /* asked not to overwrite existing value. */
    67         }
    65         }
    68     }
    66     }
    69     if (!SetEnvironmentVariableA(name, *value ? value : NULL)) {
    67     if (!SetEnvironmentVariableA(name, *value ? value : NULL)) {
    70         return -1;
    68         return -1;