On 06/24/13 02:12 AM, walter harms wrote:
Am 23.06.2013 20:53, schrieb Alan Coopersmith:
Signed-off-by: Alan Coopersmith <[email protected]>
---
src/Xv.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/Xv.c b/src/Xv.c
index ee80959..5df5464 100644
--- a/src/Xv.c
+++ b/src/Xv.c
@@ -190,7 +190,7 @@ XvQueryAdaptors(
}
size = rep.length << 2;
- if ((buffer = (char *) Xmalloc((unsigned) size)) == NULL) {
+ if ((buffer = Xmalloc(size)) == NULL) {
IMHO this is more readable:
buffer = Xmalloc(size);
if (bufffer == NULL ) {
Yes, but the if ((buffer = Xmalloc(size)) == NULL) is a common style
in X.Org code, and wasn't the problem I'm looking to solve here.
@@ -237,7 +237,7 @@ XvQueryAdaptors(
size = u.pa->name_size;
u.buffer += (sz_xvAdaptorInfo + 3) & ~3;
- if ((name = (char *) Xmalloc(size + 1)) == NULL) {
+ if ((name = Xmalloc(size + 1)) == NULL) {
XvFreeAdaptorInfo(pas);
Xfree(buffer);
UnlockDisplay(dpy);
is it possible that this is a version of asprintf() here ?
No. This code is taking a length-counted, non-nil-terminated
string from the wire protocol and converting it to a standard
C style nil-terminated string.
It would probably be suitable for strndup(), but that's not
universally supported yet.
--
-Alan Coopersmith- [email protected]
Oracle Solaris Engineering - http://blogs.oracle.com/alanc
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel