Re: [HACKERS] SetVariable

2003-09-01 Thread Gaetano Mendola
"Bruce Momjian" <[EMAIL PROTECTED]> wrote: > Mendola Gaetano wrote: > > "Bruce Momjian" <[EMAIL PROTECTED]> wrote: > > > Gaetano Mendola wrote: > > > > "Bruce Momjian" <[EMAIL PROTECTED]> wrote: > > > > > I see other strdup() calls that don't check on a return. Should we > > deal > > > > > with th

Re: [HACKERS] SetVariable

2003-09-01 Thread Bruce Momjian
Mendola Gaetano wrote: > "Bruce Momjian" <[EMAIL PROTECTED]> wrote: > > Gaetano Mendola wrote: > > > "Bruce Momjian" <[EMAIL PROTECTED]> wrote: > > > > I see other strdup() calls that don't check on a return. Should we > deal > > > > with those too? > > > > > > Well strdup obtain the memory for th

Re: [HACKERS] SetVariable

2003-09-01 Thread Mendola Gaetano
"Bruce Momjian" <[EMAIL PROTECTED]> wrote: > Gaetano Mendola wrote: > > "Bruce Momjian" <[EMAIL PROTECTED]> wrote: > > > I see other strdup() calls that don't check on a return. Should we deal > > > with those too? > > > > Well strdup obtain the memory for the new string using a malloc > > and nor

Re: [HACKERS] SetVariable

2003-08-30 Thread Gaetano Mendola
"Tom Lane" <[EMAIL PROTECTED]> wrote: > "Gaetano Mendola" <[EMAIL PROTECTED]> writes: > > "Tom Lane" <[EMAIL PROTECTED]> wrote: > >> strdup -> xstrdup if you're concerned. > > > May be is a good idea avoid the future use: > > #define strdup STRDUP_DEPRECATED_USE_INSTEAD_XSTRDUP > > Not a good i

Re: [HACKERS] SetVariable

2003-08-30 Thread Tom Lane
"Gaetano Mendola" <[EMAIL PROTECTED]> writes: > "Tom Lane" <[EMAIL PROTECTED]> wrote: >> strdup -> xstrdup if you're concerned. > May be is a good idea avoid the future use: > #define strdup STRDUP_DEPRECATED_USE_INSTEAD_XSTRDUP Not a good idea --- there are places that want to check for strdup

Re: [HACKERS] SetVariable

2003-08-30 Thread Gaetano Mendola
"Tom Lane" <[EMAIL PROTECTED]> wrote: > Bruce Momjian <[EMAIL PROTECTED]> writes: > > I see other strdup() calls that don't check on a return. Should we deal > > with those too? > > strdup -> xstrdup if you're concerned. May be is a good idea avoid the future use: #define strdup STRDUP_DEPRECA

Re: [HACKERS] SetVariable

2003-08-30 Thread Gaetano Mendola
"Bruce Momjian" <[EMAIL PROTECTED]> wrote: > Gaetano Mendola wrote: > > "Bruce Momjian" <[EMAIL PROTECTED]> wrote: > > > I see other strdup() calls that don't check on a return. Should we deal > > > with those too? > > > > Well strdup obtain the memory for the new string using a malloc > > and nor

Re: [HACKERS] SetVariable

2003-08-30 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: > I see other strdup() calls that don't check on a return. Should we deal > with those too? strdup -> xstrdup if you're concerned. regards, tom lane ---(end of broadcast)--- TIP 6:

Re: [HACKERS] SetVariable

2003-08-30 Thread Bruce Momjian
Gaetano Mendola wrote: > "Bruce Momjian" <[EMAIL PROTECTED]> wrote: > > I see other strdup() calls that don't check on a return. Should we deal > > with those too? > > Well strdup obtain the memory for the new string using a malloc > and normally is a good habit check the return value of a malloc

Re: [HACKERS] SetVariable

2003-08-30 Thread Gaetano Mendola
"Bruce Momjian" <[EMAIL PROTECTED]> wrote: > I see other strdup() calls that don't check on a return. Should we deal > with those too? Well strdup obtain the memory for the new string using a malloc and normally is a good habit check the return value of a malloc. Regards Gaetano Mendola --

Re: [HACKERS] SetVariable

2003-08-30 Thread Bruce Momjian
Mendola Gaetano wrote: > Hi all, > I found this code on the file variables.c and > in the function SetVariable I read: > > if (strcmp(current->name, name) == 0) > { >free(current->value); >current->value = strdup(value); >return current->value ? true : f

Re: [HACKERS] SetVariable

2003-08-28 Thread Mendola Gaetano
Just a follow up, is it better to give a patch for this kind of stuff ? Regards Gaetano Mendola ""Mendola Gaetano"" <[EMAIL PROTECTED]> wrote: > Hi all, > I found this code on the file variables.c and > in the function SetVariable I read: > > if (strcmp(current->name, name) == 0) > { >

[HACKERS] SetVariable

2003-08-28 Thread Mendola Gaetano
Hi all, I found this code on the file variables.c and in the function SetVariable I read: if (strcmp(current->name, name) == 0) { free(current->value); current->value = strdup(value); return current->value ? true : false; } this mean that if there is no me