Skip to content

Code Cleanup Blueprints

Enrico Weigelt edited this page Aug 8, 2025 · 9 revisions

This page represents a collection of tasks that can be done by new contributors. If you are unsure whether to add something or make a change to this page, just talk about it.

Feel free to work on them, send draft PRs so we can discuss it.

c99 style variable declarations

Lots of code is still written for c89, which required variables ontop of functions and didn't support scoped variables.

Goal: declare and initialize variables where needed (instead of ontop)

request dispatch: move request byteswap from SProc* into Proc*

Extensions have separate dispatch handlers for swapped (starting letter S) and non-swapped case. Future rework (see branch wip/swapping_new) will move that into macros).

As preparational step, the logic from the SProc's shall be moved into corresponding Proc*'s. (if client->swapped is true), so the SProcs can be removed.

phase out explicit initialization of struct xorg_list

Since commit include: list.h: allow zero-initialization of struct xorg_list · X11Libre/xserver@9461072, the struct xorg_list doesn't need to be explicitly initialized - having it cleared with zeros is enough. All calls on it will initiialize it on demand.

Thus, we don't need to explicitly call xorg_list_init() anymore, if it's guaranteed that the struct had been zero'ed out before.

rename the Error() macro in xf86 parser

The name isn't very clear - name should somehow tell that it's only specific to the xf86 config file parser

static size asserts for X11 protocol structs

Traditionally, the X protocol headers have (manually written) sz_* defines for (network) sizes of the corresponding structs. Many places of the Xserver using the SIZEOF(typename) macro for retrieving them by given typename, but many others are directly using sizeof() operator.

In general, the structs all should be properly padded, so SIZEOF() and sizeof() should match, and we're free to use sizeof() everywhere. But just as a precaution (in case there's a bug in X11 protocol headers), there should be compile-time asserts for that.

See: https://github.com/X11Libre/xserver/pull/403

fbdevhw

  • document fbdevhw's FRAMEBUFFER environment variable (-> manpage ?)
  • add global config (xorg.conf) option for this (not device specific, but really global)

old compat wrappers

We've still got lots of old compat wrappers, that aren't needed anymore, eg.

  • drivers: support code for ancient Xserver versions (don't need anything below 25.0.0.1 anymore)
  • Xserver vs pixman: PICT_* macros
  • REGION_NUM_RECTS

Region* inline functions

  • use CARD32 for sizes

Clone this wiki locally