Re: [HACKERS] Did the inet type get backed out? - Mailing list pgsql-hackers
From | Bruce Momjian |
---|---|
Subject | Re: [HACKERS] Did the inet type get backed out? |
Date | |
Msg-id | 199810170359.XAA00934@candle.pha.pa.us Whole thread Raw |
In response to | Re: [HACKERS] Did the inet type get backed out? (Tom Ivar Helbekkmo <tih@nhh.no>) |
List | pgsql-hackers |
Applied. BAD defines removed for existing functions. Oops. > Bruce Momjian <maillist@candle.pha.pa.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" > -- Bruce Momjian | http://www.op.net/~candle maillist@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
pgsql-hackers by date: