1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-15 20:29:03 +00:00

make a ton of global symbols static

This commit is contained in:
fyodor
2006-03-05 23:59:46 +00:00
parent 7224f4a52d
commit 76ab1500b3
25 changed files with 2982 additions and 3194 deletions

View File

@@ -371,71 +371,6 @@ int Send(int sd, const void *msg, size_t len, int flags) {
return (res < 0)? -1 : (int) len;
}
// Write data to a file descriptor, keep retrying until an error or the full length
// is written. Returns -1 if there is an error, or len if the full length was sent.
// Note that this does NOT work well on Windows using sockets -- so use Send() above
// for those. I don't know if it works with regular files on Windows with files).
ssize_t Write(int fd, const void *buf, size_t count) {
int res;
unsigned int len;
len = 0;
do {
res = write(fd,(char *) buf + len,count - len);
if (res > 0)
len += res;
} while(len < count && (res != -1 || socket_errno() == EINTR));
return (res == -1)? -1 : (int) count;
}
/* gcd_1 and gcd_n_long were sent in by Peter Kosinar <goober@gjh.sk>
Not needed for gcd_n_long, just for the case you'd want to have gcd
for two arguments too. */
unsigned long gcd_ulong(unsigned long a, unsigned long b)
{
/* Shorter
while (b) { a%=b; if (!a) return b; b%=a; } */
/* Faster */
unsigned long c;
if (a<b) { c=a; a=b; b=c; }
while (b) { c=a%b; a=b; b=c; }
/* Common for both */
return a;
}
unsigned long gcd_n_ulong(long nvals, unsigned long *val)
{
unsigned long a,b,c;
if (!nvals) return 1;
a=*val;
for (nvals--;nvals;nvals--)
{
b=*++val;
if (a<b) { c=a; a=b; b=c; }
while (b) { c=a%b; a=b; b=c; }
}
return a;
}
unsigned int gcd_uint(unsigned int a, unsigned int b)
{
/* Shorter
while (b) { a%=b; if (!a) return b; b%=a; } */
/* Faster */
unsigned int c;
if (a<b) { c=a; a=b; b=c; }
while (b) { c=a%b; a=b; b=c; }
/* Common for both */
return a;
}
unsigned int gcd_n_uint(int nvals, unsigned int *val)
{
unsigned int a,b,c;