[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] xenconsole: add option to avoid escape sequences in log
On Wed, Jul 25, 2018 at 1:53 AM, Wei Liu <wei.liu2@xxxxxxxxxx> wrote:
The above code doesn't write the value that was checked into the destination buffer; instead it does a second copy from the source buffer. That is a problematic code pattern that we shouldn't really encourage.
That may be shorter but it is harder to understand, whereas Marek's original code is clear and well structured. One nit with the proposed patch is the introduction of the dynamically size array on the stack, with input to the function determining its size: > static int write_all(int fd, const char* buf, size_t len) > { > + char buf_replaced[len]; That might be just fine for userspace code, but would it be better replaced with a fixed size buffer and a loop instead? Christopher _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |