[HACKERS] name.c

2013-12-01 Thread mohsen soodkhah mohammadi
in name.c file in source code of postgresql
I find some fuctions that I don't know where did use them?
the functions are:
int namecpy(Name n1, Name n2){..}
int namecat(Name n1, Name n2){..}
int namecmp(Name n1, Name n2){..}
int namestrcpy(Name name, const char *str){..}
int namestrcat(Name name, const char *str){..}
also before some of these functions became the #ifdef NOT_USED
when NOT_USED is set?and why it set?
thanks.


Re: [HACKERS] name.c

2013-12-01 Thread Michael Paquier
On Sun, Dec 1, 2013 at 4:59 PM, mohsen soodkhah mohammadi
mohsensoodk...@gmail.com wrote:
 in name.c file in source code of postgresql
 I find some fuctions that I don't know where did use them?
 the functions are:
 int namecpy(Name n1, Name n2){..}
 int namecat(Name n1, Name n2){..}
 int namecmp(Name n1, Name n2){..}
 int namestrcpy(Name name, const char *str){..}
 int namestrcat(Name name, const char *str){..}
 also before some of these functions became the #ifdef NOT_USED
 when NOT_USED is set?and why it set?
It is set like that so as those functions are simply ignored at
compilation. Then by looking at the git history:
- namecmp has been set as NOT_USED by this commit 15 years ago:
commit 173c555948b9002b3b899d7331682e8812d171dc
Author: Bruce Momjian br...@momjian.us
Date:   Thu Oct 8 18:30:52 1998 +

Make functions static or ifdef NOT_USED.  Prevent pg_version creation.
- For namestrcat and namecat it is a bit older, 16 years ago:
commit 1d8bbfd2e7cfb72cbe4d5c5d4fa650a28dedac0b
Author: Bruce Momjian br...@momjian.us
Date:   Tue Aug 19 21:40:56 1997 +

Make functions static where possible, enclose unused functions in
#ifdef NOT_USED.

Those functions should be removed perhaps?
Regards,
-- 
Michael


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] name.c

2013-12-01 Thread Andrew Dunstan


On 12/01/2013 02:59 AM, mohsen soodkhah mohammadi wrote:

in name.c file in source code of postgresql
I find some fuctions that I don't know where did use them?
the functions are:
int namecpy(Name n1, Name n2){..}
int namecat(Name n1, Name n2){..}
int namecmp(Name n1, Name n2){..}
int namestrcpy(Name name, const char *str){..}
int namestrcat(Name name, const char *str){..}
also before some of these functions became the #ifdef NOT_USED
when NOT_USED is set?and why it set?
thanks.




It's never defined, of course, or else the name would be a lie. That 
means this is essentially dead code which we haven't removed for some 
reason.


If you want to find out where something is used, grep -r is one way to 
look. ctags is another. Each developer has his/her own way of doing 
tasks like this.


cheers

andrew


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers