SDL_getenv_unsafe(3)

πŸ’– SDL_getenv_unsafe(3) πŸ’–

okay bestie, we're in the SDL3 FUNCTIONS section of the SDL3 manual, and today's episode is all about SDL_getenv_unsafe β€” yes the name is a little ominous, we'll get to that, breathe 🫢


✨ NAME ✨

SDL_getenv_unsafe β€” grab the value of a variable out of the environment 🌸


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <SDL3/SDL_stdinc.h>

const char * SDL_getenv_unsafe(const char *name);

πŸ’… DESCRIPTION πŸ’…

so like, this function bypasses SDL's cached copy of the environment, and it is not thread-safe. that's the whole vibe of it, no cap 😭

on some platforms, this may make case-insensitive matches, while other platforms are case-sensitive. so the move is: be precise with the strings you use for queries through this interface, fr fr. meanwhile SDL_getenv is always case-sensitive, periodt. ✨


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • name β€” the name of the variable to get. like, the name. of the variable. iconic of it πŸ’–

πŸ‘‘ RETURN VALUE πŸ‘‘

returns a pointer to the value of the variable or NULL if it can't be found πŸ™ˆ


🌈 THREAD SAFETY 🌈

this function is not thread safe, so bestie... consider using SDL_getenv() instead 🫢


⭐ AVAILABILITY ⭐

this function has been available since SDL 3.2.0 ✨


πŸ“ SEE ALSO πŸ“


and that's the page!! slay πŸ’œ this lil' slice of the manual comes to you from Simple Directmedia Layer, version SDL 3.4.18, and yeah the footer still says SDL_getenv_unsafe(3) down there because it's her page and she's the main character πŸ‘‘ bye bestie, hydrate and check your env vars πŸ’–πŸ§šπŸŒΈ

πŸ“¦ where this page comes from