[llvm-commits] [PATCH] Remove the use of C string function in Errno.cpp
Dmitri Gribenko
gribozavr at gmail.com
Thu Sep 27 01:54:51 PDT 2012
On Thu, Sep 27, 2012 at 9:55 AM, Martinez, Javier E
<javier.e.martinez at intel.com> wrote:
> This patch is to remove the use of strncpy and sprintf in Errno.cpp and
> replace them with operations on LLVM string objects. This is the first of a
> series of patches to remove the use of C string functions. For some
> background on this please the attached conversation. As I’m pretty
> inexperienced submitting patches please let me know if I need to do things
> differently.
- sprintf(buffer, "Error #%d", errnum);
+ format_object1<int> formatError("Error #%d",errnum);
+ formatError.snprint(buffer, MaxErrStrLen);
+ str = buffer;
I think it is better to use raw_string_ostream with str directly here.
Dmitri
--
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
More information about the llvm-commits
mailing list