Svante Signell, le Tue 11 Feb 2014 19:49:46 +0100, a écrit : > On Tue, 2014-02-11 at 19:24 +0100, Samuel Thibault wrote: > > Svante Signell, le Tue 11 Feb 2014 18:52:28 +0100, a écrit : > > > Maybe I got it wrong then, perhaps const would be better. > > > > Const would mean you're preventing yourself from writing to it. But you > > *want* to write to it with snprintf. Why do you believe you need to add > > something else than char*? > > Never mind for this case, (and I used static, to make it local for that > function?)
For function-local variables, static does not change the visibility, it only changes whether it's allocated on the stack or permanently. > > > - char path_buf[PATH_MAX]; > > > + char *path_buf = NULL; > > > > Why setting it to NULL? > > To avoid compiler warnings? The warning was for a good reason: > > > - snprintf(path_buf, sizeof(path_buf), "%s/%s", PKGLIBDIR, zombie); > > > + len = strlen(PKGLIBDIR) + 1 + strlen(zombie) + 1; > > > > That seems to be missing a malloc here, doesn't it? > > Ah, thanks! This one. Do not consider compiler warning as noise, but as clue that something was wrong in your code. It's very rare that the compiler is wrong about warnings. Samuel -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected] Archive: http://lists.debian.org/[email protected]

