CVS update: samba/source/libads

Jim McDonough jmcd at us.ibm.com
Thu Jun 27 07:13:28 EST 2002


>This is not the way to do it.
>
>If 'push_utf8_allocate()' fails, then we have bigger problems - so just
>clean up and fail at that point.  Don't try to be smart and set the
>value anyway.
>
>Also, C has a 'uncostifiy' function already:  strdup().  I am really not
>convinced that casting to a void* makes the solution any more clear.
>
>Remember, C warnings are not 'a thing to be got rid of', but a tool to
>help you find more fundemental flaws in your program.  Use them - they
>really are there to help you.
Be careful what you say.  The assignment was there to begin with...you just
didn't notice it until this round.

As for what to do when it fails, I agree with you, but take it up with
Tridge.   Perhaps I misunderstood what he was asking for, but from what I
recall it was basically this: don't fail if the conversion doesn't work.

As for the warnings, I'd rather leave them there than try to eliminate
them.  Sometimes you know better than the compiler, and allocating more
memory just to get rid of a warning isn't always going to help.  In this
specific case, strdup is definitely not the answer...failing is.  In other
parts, I'd rather just leave them in.  Thanks for the info compiler, I'll
take it into consideration.

The difficulty is when you rely on others' protoypes, if they're not strict
about it, but you want to be...ldap does not modify the string, so why
should I allocate yet more memory just to satisfy the compiler?

----------------------------
Jim McDonough
IBM Linux Technology Center
Samba Team
6 Minuteman Drive
Scarborough, ME 04074
USA

jmcd at us.ibm.com
jmcd at samba.org

Phone: (207) 885-5565
IBM tie-line: 776-9984






More information about the samba-cvs mailing list