best place for xstrdup

Поиск
Список
Период
Сортировка
От Mendola Gaetano
Тема best place for xstrdup
Дата
Msg-id 027e01c37c61$ac738670$152aa8c0@GMENDOLA2
обсуждение исходный текст
Ответы Re: best place for xstrdup  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
As suggested by Bruce Mojiman I'm working on 
substitute some strdup not checked with xstrdup.

I seen that in the backend source tree there is no
xstrdup ( there is one in bin/psql tree) , 
I wrote it and inserted temporarelly in 
backend/utils/mmgr/aset.c

I don't know exactly how work the error report 
mechanism sso before to submit a wrong implementation
this was what I wrote:

char *xstrdup(const char *string)
{   char * ret_value;
   if ( !string ) {       elog(ERROR, "xstrdup called with a NULL pointer");   }
   ret_value = strdup( string );
   if ( !ret_value ) {       ereport(FATAL,                               (errcode(ERRCODE_OUT_OF_MEMORY),
                 errmsg("strdup out of memory")));   }
 
   return ret_value;
}

if this implementation is ok where is the best place ?

Regards
Gaetano Mendola





В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: AIX 4.2.1 CVS head and SSL
Следующее
От: Tom Lane
Дата:
Сообщение: Re: best place for xstrdup