From: Eric Engestrom <eric.engestrom@imgtec.com>
To: Emil Velikov <emil.l.velikov@gmail.com>
Cc: ML dri-devel <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH libdrm 1/3] xf86drm: replace sprintf()+strdup() with asprintf()
Date: Tue, 3 Apr 2018 17:00:17 +0100 [thread overview]
Message-ID: <20180403160017.2boqcs3irn6d2ham@imgtec.com> (raw)
In-Reply-To: <CACvgo52+mw9bBw9GMG_TY5DVuqVQ-7OJcdK1=uh+EaWN8-4dPw@mail.gmail.com>
On Monday, 2018-03-26 15:00:01 +0100, Emil Velikov wrote:
> On 26 March 2018 at 14:57, Jani Nikula <jani.nikula@linux.intel.com> wrote:
> > On Mon, 26 Mar 2018, Eric Engestrom <eric.engestrom@imgtec.com> wrote:
> >> Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
> >> ---
> >> xf86drm.c | 28 ++++++++++++++--------------
> >> 1 file changed, 14 insertions(+), 14 deletions(-)
> >>
> >> diff --git a/xf86drm.c b/xf86drm.c
> >> index 3a9d0ed2cc9b196ae7d1..b6e5d8cc1bb50ffe75a2 100644
> >> --- a/xf86drm.c
> >> +++ b/xf86drm.c
> >> @@ -2823,7 +2823,7 @@ static char *drmGetMinorNameForFD(int fd, int type)
> >> struct stat sbuf;
> >> const char *name = drmGetMinorName(type);
> >> int len;
> >> - char dev_name[64], buf[64];
> >> + char *dev_name, buf[64];
> >> int maj, min;
> >>
> >> if (!name)
> >> @@ -2848,20 +2848,22 @@ static char *drmGetMinorNameForFD(int fd, int type)
> >>
> >> while ((ent = readdir(sysdir))) {
> >> if (strncmp(ent->d_name, name, len) == 0) {
> >> - snprintf(dev_name, sizeof(dev_name), DRM_DIR_NAME "/%s",
> >> - ent->d_name);
> >> + if (asprintf(&dev_name, DRM_DIR_NAME "/%s",
> >
> > Just noting in passing that asprintf is a GNU extension, is that okay?
> >
> Was going to mention the same thing. Also POSIX please add it to the
> next version ;-)
> It doesn't seem to make the code shorter, so I'd go with let's drop this?
Those were just some local changes I had done at some random point when
coming across stuff that I thought could be better. I just sent them now
since my local changes will be lost by me leaving my current job, and
I didn't care enough to push them on a branch somewhere (:
Either these were thought to be good by someone else, or, as it is,
they're not and I'm dropping all three :)
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
prev parent reply other threads:[~2018-04-03 16:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-26 10:26 [PATCH libdrm 1/3] xf86drm: replace sprintf()+strdup() with asprintf() Eric Engestrom
2018-03-26 10:26 ` [PATCH libdrm 2/3] xf86drm: add buffer size safety to sprintf() Eric Engestrom
2018-03-26 14:02 ` Emil Velikov
2018-03-26 10:26 ` [PATCH libdrm 3/3] xf86drm: replace stat() with access() to verify file existence Eric Engestrom
2018-03-26 14:03 ` Emil Velikov
2018-03-26 13:57 ` [PATCH libdrm 1/3] xf86drm: replace sprintf()+strdup() with asprintf() Jani Nikula
2018-03-26 14:00 ` Emil Velikov
2018-04-03 16:00 ` Eric Engestrom [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180403160017.2boqcs3irn6d2ham@imgtec.com \
--to=eric.engestrom@imgtec.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=emil.l.velikov@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.