Subject: Re: libssh2 master 3420e98... use const to silence a bazillion warnings

Re: libssh2 master 3420e98... use const to silence a bazillion warnings

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 2 Mar 2010 19:37:32 +0100 (CET)

On Tue, 2 Mar 2010, Alexander Lamaison wrote:

> I left the errmsg parameter non-const as the string may be freed when the
> should_free parameter is true. Now that it's const, I get warnings in all
> the places that try to free it.

Haha, I got the reverse. I got warnings all over when passing const strings to
arguments not using const...

> Do we ever actually call libssh2_error with a string we want freed? I've not
> come across any but its tricky to search for.

I did a search for it and I find two or three cases. I'm not at all convinced
those rare cases are worth fighting for. Or perhaps I would even prefer having
a static char array and then allow sprintf()-style arguments to make the error
message. It would then of course be limited to a fixed length, like 80 or 120
characters or so.

How would others feel about that?

-- 
  / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-03-02