mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-04-20 03:35:41 +02:00
xcb: no need to heap allocate a buffer for the vendor string
This commit is contained in:
parent
921cda0a81
commit
9dd179ca67
1 changed files with 2 additions and 8 deletions
10
xcb.c
10
xcb.c
|
@ -32,23 +32,17 @@ xcb_init(void)
|
|||
|
||||
const xcb_setup_t *setup = xcb_get_setup(conn);
|
||||
|
||||
/* Vendor string */
|
||||
int length = xcb_setup_vendor_length(setup);
|
||||
char *vendor = malloc(length + 1);
|
||||
memcpy(vendor, xcb_setup_vendor(setup), length);
|
||||
vendor[length] = '\0';
|
||||
|
||||
/* Vendor release number */
|
||||
unsigned release = setup->release_number;
|
||||
unsigned major = release / 10000000; release %= 10000000;
|
||||
unsigned minor = release / 100000; release %= 100000;
|
||||
unsigned patch = release / 1000;
|
||||
|
||||
printf("%s %u.%u.%u (protocol: %u.%u)\n", vendor,
|
||||
printf("%.*s %u.%u.%u (protocol: %u.%u)\n",
|
||||
xcb_setup_vendor_length(setup), xcb_setup_vendor(setup),
|
||||
major, minor, patch,
|
||||
setup->protocol_major_version,
|
||||
setup->protocol_minor_version);
|
||||
free(vendor);
|
||||
|
||||
const xcb_query_extension_reply_t *randr =
|
||||
xcb_get_extension_data(conn, &xcb_randr_id);
|
||||
|
|
Loading…
Add table
Reference in a new issue