summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2024-04-27 15:58:12 -0700
committerVito Caputo <vcaputo@pengaru.com>2024-04-27 15:58:12 -0700
commit165e6639469a5b8d81cc7511b4b9fde302d974aa (patch)
tree5e82de39a040d94f79df2e2619810acd32b8ae90
parente857fdf9828267d8df859bcf3c88c3d88f12d462 (diff)
drm_fb: assert() asprintfs succeed
just silencing more compilers that are upset about this w/-Werror -Wall it'd be better to handle these errors gracefully, but there's not really much up-side to that in drm setup phase...
-rw-r--r--src/drm_fb.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/drm_fb.c b/src/drm_fb.c
index 2dd4f98..8ba097c 100644
--- a/src/drm_fb.c
+++ b/src/drm_fb.c
@@ -125,7 +125,7 @@ static int get_connectors(const char *dev, char ***res_connectors)
}
counts[con->connector_type]++;
- asprintf(&connectors[i], "%s-%i", connector_type_name(con->connector_type), counts[con->connector_type]); /* TODO: errors */
+ assert(asprintf(&connectors[i], "%s-%i", connector_type_name(con->connector_type), counts[con->connector_type]) >= 0); /* TODO: errors */
drmModeFreeConnector(con);
}
@@ -200,7 +200,7 @@ static int lookup_connector(int fd, const char *connector, drmModeConnector **re
}
counts[con->connector_type]++;
- asprintf(&str, "%s-%i", connector_type_name(con->connector_type), counts[con->connector_type]); /* TODO: errors */
+ assert(asprintf(&str, "%s-%i", connector_type_name(con->connector_type), counts[con->connector_type]) >= 0); /* TODO: errors */
if (!strcasecmp(str, connector)) {
free(str);
@@ -250,7 +250,7 @@ static int get_modes(const char *dev, const char *connector, const char ***res_m
}
for (int i = 0; i < con->count_modes; i++)
- asprintf(&modes[i], "%s@%"PRIu32, con->modes[i].name, con->modes[i].vrefresh);
+ assert(asprintf(&modes[i], "%s@%"PRIu32, con->modes[i].name, con->modes[i].vrefresh) >= 0); /* TODO: errors */
*res_modes = (const char **)modes;
@@ -316,7 +316,7 @@ static drmModeModeInfo * lookup_mode(drmModeConnector *connector, const char *mo
for (i = 0; i < connector->count_modes; i++) {
char *str;
- asprintf(&str, "%s@%"PRIu32, connector->modes[i].name, connector->modes[i].vrefresh);
+ assert(asprintf(&str, "%s@%"PRIu32, connector->modes[i].name, connector->modes[i].vrefresh) >= 0); /* TODO: errors */
if (!strcasecmp(str, mode)) {
free(str);
© All Rights Reserved