incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: [PATCH] stdlib patch
Date Thu, 28 Sep 2006 16:50:54 GMT
Farid Zaripov wrote:
>   Attached is a patch for stdlib library.
> 
>   ChangeLog:
>   * _num_put.cc (__rw_iter_failed): Removed const to resolve
>   ambiguity on MSVC 7.0
>   * _select.h [_RWSTD_NO_CLASS_PARTIAL_SPEC]: Added __rw_is_same
>   for compilers which not support the partial template specialization

This looks okay.

>   * sstream.cc (basic_stringbuf<>::str): Added check before deallocate
>   the old buffer

I'm wondering about this change. Does it fix a bug?

If there's a bug in the library we need an issue in Jira with a test
case that reproduces it. The fix for the bug should then be committed
separately from any other changes. We should also have a test that
exercises the bug. If no such test exists, we need to write one :)

If there is no bug, can you explain how the change is beneficial?

>   * file.cpp: Declare fileno() only if it not declared in CRT header,
>   but presend in libc

Okay.

>   * exception.cpp [_MSC_VER]: #undefined _RWSTD_NO_VSNPRINTF after
>   #define vsnprintf _vsnprintf

Okay.

>   (__rw_free_what_buf): New function to free buffer for what message

This function should probably be inline for efficiency, don't you
think?

>   (__rw_vfmtwhat): Used __rw_free_what_buf to free buffer
>   (__rw_throw_exception [_RWSTD_NO_EXCEPTIONS]): Used __rw_free_what_buf
>   to free buffer

Okay.

>   (__rw_throw_exception [!_RWSTD_NO_EXCEPTIONS]): Don't free buffer
>   before return from function

Doesn't this cause a memory leak?

FYI, I believe we have a problem here when a program sets up its own
exception function (__rw_throw_proc) and tries to delete the character
string that's passed to it by the library the delete will fail when
the string is in the thread local buffer. I think this causes the
example program rwexcept.cpp to crash on some platforms.

Does your change have anything to do with this? In any case, if
it fixes a bug we need to go through the process I outlined above.

>   (__rw_throw): Used __rw_free_what_buf to free buffer
>   (~__rw_exception): The same

This is okay too.

Thanks
Martin

Mime
View raw message