mirror of
https://github.com/FeralInteractive/gamemode.git
synced 2025-06-07 08:07:20 +02:00
gamemode: Add a helper to compare string tails
Signed-off-by: Kai Krakow <kai@kaishome.de>
This commit is contained in:
parent
c2344f4387
commit
373fe5a8af
@ -74,6 +74,17 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#define safe_snprintf(b, s, ...) \
|
#define safe_snprintf(b, s, ...) \
|
||||||
(snprintf(b, sizeof(b), s, __VA_ARGS__) < (ssize_t)sizeof(b) ? strndup(b, sizeof(b)) : NULL)
|
(snprintf(b, sizeof(b), s, __VA_ARGS__) < (ssize_t)sizeof(b) ? strndup(b, sizeof(b)) : NULL)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function: Test, if haystack ends with needle.
|
||||||
|
*/
|
||||||
|
static inline const char *strtail(const char *haystack, const char *needle)
|
||||||
|
{
|
||||||
|
char *pos = strstr(haystack, needle);
|
||||||
|
if (pos && (strlen(pos) == strlen(needle)))
|
||||||
|
return pos;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The GameModeClient encapsulates the remote connection, providing a list
|
* The GameModeClient encapsulates the remote connection, providing a list
|
||||||
* form to contain the pid and credentials.
|
* form to contain the pid and credentials.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user