Move the declaration of the reply struct down to after the payload has
been finally assembled, so we don't need extra payload size compuation
anymore.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Use x_rpcbuf_t for reply payload assembly, instead of pre-counting and
pre-allocating buffer.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Use x_rpcbuf_t for reply payload assembly, instead of pre-counting and
pre-allocating buffer.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Since the x_rpcbuf already knows how much had been written, there's no
need for extra payload size computation anymore - just pick the number
of written bytes from the x_rpcbuf.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
use x_rpcbuf_t operations for constructing the reply payload, so we don't
need to do the byte-swapping explicitly anymore.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Second step of migrating ProcVidModeGetAllModeLines() to x_rpcbuf_t:
Let it's callees also use x_rpcbuf_t operations, instead of raw pointers.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
First step of migration to x_rpcbuf: create a buffer with enough room for
the already calculated payload size and pass the raw buffer pointer to
our callees as we used to do with the calloc()ed one.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
When iterating screen lists, consistently use the same variable name
`walkScreen` for holding current screen pointer everywhere.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
take way the extra scope / indention on the `if (nbox)` statement and
use `continue` instead.
Hint: for easier review, one can use `git diff -w` in order to suppress
the indention-only changes.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
in preparation of upcoming new iterator macros, phase out
FOR_NSCREENS_FORWARD_SKIP, so we don't need an additional macro
for just the case where first screen is skipped.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Instead of always accessing the global screens array, do it only once
and put it into a walk variable.
Also prepration for upcoming commits which are moving the looping logic
into a generic macro.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Use a separate variable pWalkDraw for inside the loop, as it's got a
different purpose in here.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
The global (exported) serverGeneration field is `unsigned long`, while
many other places copy it and compare it two other integer types, eg.
plain `int` (which is signed). Even if it's unlikely ever reaching such
high number of generations that it will ever make trouble, it's still
a good idea to clean this up and use the same type everywhere.
For clearity, introducing a typedef `x_server_generation_t` which is
used everywhere, instead of raw `unsigned long`.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
The namespace config still has the "container" directive, which should have
been named "namespace". It's a leftover from the original working draft that
was named "container extension".
For the time being, keep backwards compatibility by allowing both tokens
"container" as well as "namespace" for the same directive. But consider the
old token as deprecated, it shouldn't be used anymore and might go away
in the near future.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
In the non-XINERAMA code path, a parameter was missing.
Fixes: a57db845bbc67a7fe3f90390365420692b16b1ab
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
If we've already got the ScreenPtr, there's no need to retrieve it again
via the screen number, which we're getting via the ScreenPtr that we've
already got.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Use the payload size from the rpcbuf, but also compare that with our
computation as sanity check and log error on mismatch.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Instead doing an exrtra loop for our own calculation of the
payload size, just the wpos from rpcbuf.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
In preparation for subsequent refactoring, assembling the reply header
at once, instead of doing it piece by pice.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
The payload length is already known after writing everything to the
buffer, so no need for extra size computation anymore.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Preparation for subsequent changes: instead of returning early when no
payload to send, move that into a conditional block.
(the WriteRpcbufToClient() call on potentially empty buffer is intentional)
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
As a prepration for upcoming changes, move assembly of the the reply
header further downwards where all values are already known, so we'll
have to touch it only once. Also eliminate the separate write path for
the case where Xv is disabled.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
For easier understanding the code, declare the variables right where
they're assigned first.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Move down reply struct declaration/assignment and byte-swapping to
right before the write-out.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
* declare and assign in one shot
* move down reply struct declaration to where it's needed
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
* declare and assign them right where they're needed, in one shot
* drop unnecessary assignment and byte-swap of zero values
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
The authProto field always is assigned to dynamically allocated buffer
(strdup()'ed) and needs to be freed sometimes, so cannot be const.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>