mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 21:32:45 +00:00
Use STRLEN_CONST where possible; and don't needlessly do strlen
twice
This commit is contained in:
parent
12012b5041
commit
f84c6ec8cd
@ -124,19 +124,21 @@ static int GLXExtensionSupported(Display *dpy, const char *extension)
|
||||
const char *extensionsString = glXQueryExtensionsString(dpy, DefaultScreen(dpy));
|
||||
const char *client_extensions = glXGetClientString(dpy, GLX_EXTENSIONS);
|
||||
const char *pos = strstr(extensionsString, extension);
|
||||
size_t pos_ext_len = strlen(extension);
|
||||
|
||||
if ( pos &&
|
||||
(pos == extensionsString || pos[-1] == ' ') &&
|
||||
(pos[strlen(extension)] == ' ' || pos[strlen(extension)] == '\0')
|
||||
(pos[pos_ext_len] == ' ' || pos[pos_ext_len] == '\0')
|
||||
)
|
||||
return 1;
|
||||
|
||||
pos = strstr(client_extensions, extension);
|
||||
pos = strstr(client_extensions, extension);
|
||||
pos_ext_len = strlen(extension);
|
||||
|
||||
if (
|
||||
pos &&
|
||||
(pos == extensionsString || pos[-1] == ' ') &&
|
||||
(pos[strlen(extension)] == ' ' || pos[strlen(extension)] == '\0')
|
||||
(pos[pos_ext_len] == ' ' || pos[pos_ext_len] == '\0')
|
||||
)
|
||||
return 1;
|
||||
|
||||
|
@ -24,8 +24,11 @@
|
||||
#include <net/net_socket.h>
|
||||
#include <encodings/base64.h>
|
||||
#include <streams/file_stream.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include "../../deps/bearssl-0.6/inc/bearssl.h"
|
||||
|
||||
/* TODO/FIXME - static global variables */
|
||||
static br_x509_trust_anchor TAs[500] = {};
|
||||
static size_t TAs_NUM = 0;
|
||||
|
||||
@ -113,12 +116,13 @@ static void append_certs_pem_x509(char * certs_pem)
|
||||
void * cert_bin;
|
||||
int cert_bin_len;
|
||||
|
||||
while (true)
|
||||
for (;;)
|
||||
{
|
||||
cert = strstr(cert_end, "-----BEGIN CERTIFICATE-----");
|
||||
if (!cert) break;
|
||||
cert += strlen("-----BEGIN CERTIFICATE-----");
|
||||
cert_end = strstr(cert, "-----END CERTIFICATE-----");
|
||||
if (!cert)
|
||||
break;
|
||||
cert += STRLEN_CONST("-----BEGIN CERTIFICATE-----");
|
||||
cert_end = strstr(cert, "-----END CERTIFICATE-----");
|
||||
|
||||
*cert_end = '\0';
|
||||
cert = delete_linebreaks(cert);
|
||||
|
Loading…
x
Reference in New Issue
Block a user