From: | Tom Ivar Helbekkmo <tih(at)nhh(dot)no> |
---|---|
To: | Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us> |
Cc: | darcy(at)druid(dot)net (D'Arcy J(dot)M(dot) Cain), pgsql-hackers(at)postgreSQL(dot)org |
Subject: | Re: [HACKERS] Did the inet type get backed out? |
Date: | 1998-10-16 17:51:45 |
Message-ID: | 86vhlkxumm.fsf@athene.nhh.no |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us> writes:
> I just ifdef'ed out the calls to the non-existant functions. That is
> all.
You probably meant to. What you did was to #ifdef out all the calls
to the missing inet_cidr_*() functions in the code that D'Arcy added,
_and_ the ones to the existing inet_net_*() ones that are needed for
the code to work at all. Easy mistake to make when things are named
so similarly.
If you remove the erroneous #ifdef BAD stuff, and apply the following
patch to the (current) inet_net_pton.c, we'll have a working INET type
again, only missing the improvements that D'Arcy and Paul cooperated
to hash out.
Oh, and D'Arcy: about documentation: should you and I maybe bounce a
file of SGML back and forth a couple of times, getting the type and
functions properly described? I can start it off if you like, but I'm
not sure I'll be able to find time to do it until monday...
-tih
*** inet_net_pton.c.old Fri Oct 16 19:44:25 1998
--- inet_net_pton.c.new Fri Oct 16 19:45:40 1998
***************
*** 100,133 ****
ch = *src++;
if (ch == '0' && (src[0] == 'x' || src[0] == 'X')
! && isascii(src[1]) && isxdigit(src[1]))
! {
/* Hexadecimal: Eat nybble string. */
if (size <= 0)
goto emsgsize;
- tmp = 0;
dirty = 0;
! src++; /* skip x or X. */
! while ((ch = *src++) != '\0' &&
! isascii(ch) && isxdigit(ch))
! {
if (isupper(ch))
ch = tolower(ch);
n = strchr(xdigits, ch) - xdigits;
assert(n >= 0 && n <= 15);
! tmp = (tmp << 4) | n;
if (++dirty == 2) {
if (size-- <= 0)
goto emsgsize;
*dst++ = (u_char) tmp;
! tmp = 0, dirty = 0;
}
}
! if (dirty) {
if (size-- <= 0)
goto emsgsize;
! tmp <<= 4;
! *dst++ = (u_char) tmp;
}
}
else if (isascii(ch) && isdigit(ch))
--- 100,131 ----
ch = *src++;
if (ch == '0' && (src[0] == 'x' || src[0] == 'X')
! && isascii(src[1]) && isxdigit(src[1])) {
/* Hexadecimal: Eat nybble string. */
if (size <= 0)
goto emsgsize;
dirty = 0;
! src++; /* skip x or X. */
! while ((ch = *src++) != '\0' && isascii(ch) && isxdigit(ch)) {
if (isupper(ch))
ch = tolower(ch);
n = strchr(xdigits, ch) - xdigits;
assert(n >= 0 && n <= 15);
! if (dirty == 0)
! tmp = n;
! else
! tmp = (tmp << 4) | n;
if (++dirty == 2) {
if (size-- <= 0)
goto emsgsize;
*dst++ = (u_char) tmp;
! dirty = 0;
}
}
! if (dirty) { /* Odd trailing nybble? */
if (size-- <= 0)
goto emsgsize;
! *dst++ = (u_char) (tmp << 4);
}
}
else if (isascii(ch) && isdigit(ch))
--
Popularity is the hallmark of mediocrity. --Niles Crane, "Frasier"
From | Date | Subject | |
---|---|---|---|
Next Message | Jan Wieck | 1998-10-16 18:36:08 | Re: [HACKERS] SELECT ... LIMIT (trial implementation) |
Previous Message | Jan Wieck | 1998-10-16 15:39:25 | where to get stylesheet? |