]> granicus.if.org Git - postgresql/commitdiff
- merging in Dr. George's tree with ours
authorMarc G. Fournier <scrappy@hub.org>
Mon, 22 Jul 1996 21:58:28 +0000 (21:58 +0000)
committerMarc G. Fournier <scrappy@hub.org>
Mon, 22 Jul 1996 21:58:28 +0000 (21:58 +0000)
        - src/backend/access
                - no changes
        - src/backend/utils
                - mostly cosmetic changes
                - ESCAPE_PATCH Added
        - src/Makefile.global changes merged

src/Makefile.global
src/backend/utils/Gen_fmgrtab.sh
src/backend/utils/adt/arrayfuncs.c
src/backend/utils/adt/geo-ops.c
src/backend/utils/adt/misc.c
src/backend/utils/adt/nabstime.c
src/backend/utils/adt/numutils.c
src/backend/utils/adt/varlena.c
src/backend/utils/error/elog.c
src/backend/utils/error/exc.c
src/backend/utils/exc.h

index e0fa0f29e26495ace8a7e2cf8c51284b5c1e5880..93d4a1a49e13ec7da8aaff0c3a4dfcc4cfb70762 100644 (file)
@@ -7,7 +7,7 @@
 #
 #
 # IDENTIFICATION
-#    $Header: /cvsroot/pgsql/src/Attic/Makefile.global,v 1.8 1996/07/20 08:34:08 scrappy Exp $
+#    $Header: /cvsroot/pgsql/src/Attic/Makefile.global,v 1.9 1996/07/22 21:54:49 scrappy Exp $
 #
 # NOTES
 #    This is seen by any Makefiles that include mk/postgres.mk. To
@@ -67,10 +67,6 @@ SRCDIR=              /home/staff/scrappy/cvs/postgres95/src
 LEX = flex
 LDADD+= -L/usr/local/lib -lfl
 
-# Uncomment the following to bring in changes by OpenLink
-# See README.OPENLINK for applied patches
-# CFLAGS+=     -DOPENLINK_PATCHES
-
 # POSTGRESLOGIN is the login name of the user who gets special
 # privileges within the database.  By default it is "postgres", but
 # you can change it to any existing login name (such as your own 
@@ -290,7 +286,13 @@ LDFLAGS+= $(LDFLAGS_BE)
 
 # enable patches to array update code
 CFLAGS += -DARRAY_PATCH
-
+# enable patches to null insert/update code
+CFLAGS += -DNULL_PATCH
+# enable patches to array escape conversion code 
+CFLAGS += -DESCAPE_PATCH
+# enable patches for varchar and fsync
+CFLAGS += -DOPENLINK_PATCHES
 ##############################################################################
 #
 # Miscellaneous configuration
index ed5ed2feeeda2076acd5e61a59c4cae5c78166df..393044ea52b1172ece95d5dcb5ed1357e5b77aa5 100644 (file)
@@ -8,7 +8,7 @@
 #
 #
 # IDENTIFICATION
-#    $Header: /cvsroot/pgsql/src/backend/utils/Attic/Gen_fmgrtab.sh,v 1.2 1996/07/16 07:13:25 scrappy Exp $
+#    $Header: /cvsroot/pgsql/src/backend/utils/Attic/Gen_fmgrtab.sh,v 1.3 1996/07/22 21:55:40 scrappy Exp $
 #
 # NOTES
 #    Passes any -D options on to cpp prior to generating the list
@@ -81,7 +81,7 @@ cat > $HFILE <<FuNkYfMgRsTuFf
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: Gen_fmgrtab.sh,v 1.2 1996/07/16 07:13:25 scrappy Exp $
+ * $Id: Gen_fmgrtab.sh,v 1.3 1996/07/22 21:55:40 scrappy Exp $
  *
  * NOTES
  *     ******************************
@@ -175,7 +175,7 @@ cat > $TABCFILE <<FuNkYfMgRtAbStUfF
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/utils/Attic/Gen_fmgrtab.sh,v 1.2 1996/07/16 07:13:25 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/utils/Attic/Gen_fmgrtab.sh,v 1.3 1996/07/22 21:55:40 scrappy Exp $
  *
  * NOTES
  *
@@ -195,12 +195,14 @@ cat > $TABCFILE <<FuNkYfMgRtAbStUfF
 #ifdef WIN32
 #include <limits.h>
 #else
-# if defined(PORTNAME_BSD44_derived) || defined(PORTNAME_bsdi) || defined(PORTNAME_bsdi_2_1)
+# if defined(PORTNAME_BSD44_derived) || \
+     defined(PORTNAME_bsdi) || \
+     defined(PORTNAME_bsdi_2_1)
 # include <machine/limits.h>
 # define MAXINT        INT_MAX
 # else
 # include <values.h>           /* for MAXINT */
-# endif /* PORTNAME_BSD44_derived || PORTNAME_bsdi || PORTNAME_bsdi_2_1 */
+# endif /* bsd descendents */
 #endif /* WIN32 */
 
 #include "utils/fmgrtab.h"
index 8a2b0fd2910098ea012eff2f03fb42d339f065e4..a8f7089880592709cd61e86f6589dcaa34508962 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.2 1996/07/20 07:58:44 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.3 1996/07/22 21:56:00 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -224,6 +224,14 @@ _ArrayCount(char *str, int dim[], int typdelim)
         bool done = false;
         while (!done) {
             switch (*q) {
+#ifdef ESCAPE_PATCH
+            case '\\':
+                /* skip escaped characters (\ and ") inside strings */
+                if (scanning_string && *(q+1)) {
+                    q++;
+                }
+                break;
+#endif
            case '\"':
                scanning_string = ! scanning_string;
                break;
index 8262591a050227c4d045cd4b2bd854ef3459c96d..d47eda81afa352f5f344e2c05a288dc2a96500f3 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/geo-ops.c,v 1.1.1.1 1996/07/09 06:22:04 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/geo-ops.c,v 1.2 1996/07/22 21:56:01 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -717,8 +717,8 @@ long path_inter(PATH *p1, PATH *p2)
     int        i, j;
     LSEG seg1, seg2;
     
-    b1.xh = b1.yh = b2.xh = b2.yh = DBL_MAX;
-    b1.xl = b1.yl = b2.xl = b2.yl = -DBL_MAX;
+    b1.xh = b1.yh = b2.xh = b2.yh = (double)DBL_MAX;
+    b1.xl = b1.yl = b2.xl = b2.yl = -(double)DBL_MAX;
     for (i = 0; i < p1->npts; ++i) {
        b1.xh = Max(p1->p[i].x, b1.xh);
        b1.yh = Max(p1->p[i].y, b1.yh);
@@ -955,7 +955,7 @@ double *point_slope(Point *pt1, Point *pt2)
     
     result = PALLOCTYPE(double);
     if (point_vert(pt1, pt2))
-       *result = DBL_MAX;
+       *result = (double)DBL_MAX;
     else
        *result = (pt1->y - pt2->y) / (pt1->x - pt1->x);
     return(result);
@@ -965,7 +965,7 @@ double *point_slope(Point *pt1, Point *pt2)
 double point_sl(Point *pt1, Point *pt2)
 {
     return(    point_vert(pt1, pt2)
-          ? DBL_MAX
+          ? (double)DBL_MAX
           : (pt1->y - pt2->y) / (pt1->x - pt2->x) );
 }
 
@@ -1124,7 +1124,7 @@ double *lseg_distance(LSEG *l1, LSEG *l2)
        *result = 0.0;
        return(result);
     }
-    *result = DBL_MAX;
+    *result = (double)DBL_MAX;
     d = dist_ps(&l1->p[0], l2);
     *result = Min(*result, *d);
     PFREE(d);
@@ -1148,7 +1148,7 @@ double lseg_dt(LSEG *l1, LSEG *l2)
     
     if (lseg_intersect(l1, l2))
        return(0.0);
-    result = DBL_MAX;
+    result = (double)DBL_MAX;
     d = dist_ps(&l1->p[0], l2);
     result = Min(result, *d);
     PFREE(d);
@@ -1231,7 +1231,7 @@ double *dist_ps(Point *pt, LSEG *lseg)
     if (lseg->p[1].x == lseg->p[0].x)
        m = 0;
     else if (lseg->p[1].y == lseg->p[0].y) /* slope is infinite */
-       m = DBL_MAX;
+       m = (double)DBL_MAX;
     else m = (-1) * (lseg->p[1].y - lseg->p[0].y) / 
        (lseg->p[1].x - lseg->p[0].x);
     ln = line_construct_pm(pt, m);
@@ -1512,8 +1512,8 @@ long on_pl(Point *pt, LINE *line)
  */
 long on_ps(Point *pt, LSEG *lseg)
 {
-    return( point_dt(pt, &lseg->p[0]) + point_dt(pt, &lseg->p[1])
-          == point_dt(&lseg->p[0], &lseg->p[1]) );
+    return( FPeq (point_dt(pt, &lseg->p[0]) + point_dt(pt, &lseg->p[1]),
+            point_dt(&lseg->p[0], &lseg->p[1])) );
 }
 
 long on_pb(Point *pt, BOX *box)
index 094973257ac09956f5641c888ce3113d25eba03b..97c80fb4f4b5191045ac85dd1c3b795bfec31f25 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/utils/adt/misc.c,v 1.2 1996/07/16 07:13:33 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/utils/adt/misc.c,v 1.3 1996/07/22 21:56:02 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
 #include "catalog/pg_type.h"
 #include "utils/builtins.h"
 
-#if !defined(PORTNAME_linux) && !defined(PORTNAME_BSD44_derived) && \
-    !defined(PORTNAME_irix5) && !defined(PORTNAME_bsdi) && !defined(PORTNAME_bsdi_2_1) && !defined(PORTNAME_aix)
+#if !defined(PORTNAME_aix) && \
+    !defined(PORTNAME_BSD44_derived) && \
+    !defined(PORTNAME_bsdi) && \
+    !defined(PORTNAME_bsdi_2_1) && \
+    !defined(PORTNAME_irix5) && \
+    !defined(PORTNAME_linux)
 extern int random();
 extern int srandom(unsigned);
 #endif
index 8bf212bb1912d73c20b386b087f7a619f5932923..3faa3a216f9494dc63a6db906f431936801bc255 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.2 1996/07/20 08:36:19 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.3 1996/07/22 21:56:03 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -291,23 +291,24 @@ tryabsdate(char *fields[], int nf, struct tm *tm, int *tzp)
     (void) ftime(&now);
     *tzp = now.timezone;
 #else /* USE_POSIX_TIME */
-#if defined(PORTNAME_hpux) || \
-    defined(PORTNAME_aix) || \
+#if defined(PORTNAME_aix) || \
+    defined(PORTNAME_hpux) || \
+    defined(PORTNAME_i386_solaris) || \
     defined(PORTNAME_irix5) || \
-    defined(WIN32) || \
-       defined(PORTNAME_sparc_solaris) || defined(PORTNAME_i386_solaris)
+    defined(PORTNAME_sparc_solaris) || \
+    defined(WIN32)
            tzset();
 #ifndef WIN32
     *tzp = timezone / 60;              /* this is an X/Open-ism */
 #else
     *tzp = _timezone / 60;            /* this is an X/Open-ism */
 #endif /* WIN32 */
-#else /* PORTNAME_hpux || PORTNAME_aix || PORTNAME_sparc_solaris || PORTNAME_irix5 */
+#else /* PORTNAME_aix || PORTNAME_hpux || ... */
     time_t now = time((time_t *) NULL);
     struct tm *tmnow = localtime(&now);
     
     *tzp = - tmnow->tm_gmtoff / 60;    /* tm_gmtoff is Sun/DEC-ism */
-#endif /* PORTNAME_hpux || PORTNAME_aix */
+#endif /* PORTNAME_aix || PORTNAME_hpux || ... */
 #endif /* USE_POSIX_TIME */
     
     tm->tm_mday = tm->tm_mon = tm->tm_year = -1;       /* mandatory */
index 93221051f242738453d674740780c89b73287fc4..823212afa0f4fa1c2d9d918354d40c333346907b 100644 (file)
@@ -10,7 +10,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/utils/adt/numutils.c,v 1.2 1996/07/16 07:13:35 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/utils/adt/numutils.c,v 1.3 1996/07/22 21:56:03 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -132,7 +132,9 @@ ltoa(int32 l, char *a)
 int
 ftoa(double value, char *ascii, int width, int prec1, char format)
 {
-#if defined(PORTNAME_BSD44_derived) || defined(PORTNAME_bsdi) || defined(PORTNAME_bsdi_2_1)
+#if defined(PORTNAME_BSD44_derived) || \
+    defined(PORTNAME_bsdi) || \
+    defined(PORTNAME_bsdi_2_1)
        char    out[256];
        char    fmt[256];
        int     ret;
index 7b186f02fe48c5069cb64c2c1a021deaff0594f2..a00528eff194a30dc5ed6b418708807e7fac9fd6 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.3 1996/07/19 07:14:14 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.4 1996/07/22 21:56:04 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -219,23 +219,35 @@ int textlen (text* t)
  *    takes two text* and returns a text* that is the concatentation of 
  *  the two
  */
+
+/*
+ * Rewrited by Sapa, sapa@hq.icb.chel.su. 8-Jul-96.
+ */
+
 text* 
 textcat(text* t1, text* t2)
 {
     int len1, len2, newlen;
+    char *ptr;
     text* result;
 
+    /* Check for NULL strings... */
     if (t1 == NULL) return t2;
     if (t2 == NULL) return t1;
 
-    len1 = textlen (t1);
-    len2 = textlen (t2);
-    newlen = len1 + len2 + VARHDRSZ;
-    result = (text*) palloc (newlen);
+    /* Check for ZERO-LENGTH strings... */
+    /* I use <= instead of == , I know - it's paranoia, but... */
+    if((len1 = VARSIZE(t1) - VARHDRSZ) <= 0) return t2;
+    if((len2 = VARSIZE(t2) - VARHDRSZ) <= 0) return t1;
+
+    result = (text *)palloc(newlen = len1 + len2 + VARHDRSZ);
+
+    /* Fill data field of result string... */
+    memcpy(ptr = VARDATA(result), VARDATA(t1), len1);
+    memcpy(ptr + len1, VARDATA(t2), len2);
 
+    /* Set size of result string... */
     VARSIZE(result) = newlen;
-    memcpy (VARDATA(result),        VARDATA(t1), len1);
-    memcpy (VARDATA(result) + len1, VARDATA(t2), len2);
 
     return result;
 }
index 74b2edaa7b12960aa68d89df713ca2f3e1af8ae7..c961aee3dbf829196daca5cb6989292f1187e40a 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.3 1996/07/19 06:13:58 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.4 1996/07/22 21:58:26 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -48,9 +48,11 @@ elog(int lev, char *fmt, ... )
     char               buf[ELOG_MAXLEN], line[ELOG_MAXLEN];
     register char      *bp, *cp;
     extern     int     errno, sys_nerr;
-#if !defined(PORTNAME_BSD44_derived) && !defined(PORTNAME_bsdi) && !defined(PORTNAME_bsdi_2_1)
+#if !defined(PORTNAME_BSD44_derived) && \
+    !defined(PORTNAME_bsdi) && \
+    !defined(PORTNAME_bsdi_2_1)
     extern     char    *sys_errlist[];
-#endif /* !PORTNAME_BSD44_derived */
+#endif /* bsd derived */
 #ifndef PG_STANDALONE
     extern     FILE    *Pfout;
 #endif /* !PG_STANDALONE */
index 3e1b8f98b419630d73e7fdf4a8f4ade98429d4d0..532e3cb9964fb1ed4002976f2fec5567e781b852 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/utils/error/Attic/exc.c,v 1.2 1996/07/16 07:13:49 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/utils/error/Attic/exc.c,v 1.3 1996/07/22 21:58:28 scrappy Exp $
  *
  * NOTE
  *    XXX this code needs improvement--check for state violations and
@@ -90,9 +90,11 @@ ExcPrint(Exception *excP,
 {
     extern     int     errno;
     extern     int     sys_nerr;
-#if !defined(PORTNAME_BSD44_derived) && !defined(PORTNAME_bsdi) && !defined(PORTNAME_bsdi_2_1)
+#if !defined(PORTNAME_BSD44_derived) && \
+    !defined(PORTNAME_bsdi) && \
+    !defined(PORTNAME_bsdi_2_1)
     extern     char    *sys_errlist[];
-#endif /* !PORTNAME_BSD44_derived */
+#endif /* ! bsd_derived */
     
 #ifdef lint
     data = data;
index 487ecca837426c193063f9f47fee5fec26dd4b41..44300f558bcd7dd4878665c24ff58739bf32d750 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: exc.h,v 1.1.1.1 1996/07/09 06:22:01 scrappy Exp $
+ * $Id: exc.h,v 1.2 1996/07/22 21:55:41 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -23,10 +23,10 @@ extern Index ExcLineNumber;
  * ExcMessage and Exception are now defined in c.h
  */
 
-#if defined(PORTNAME_linux) \
-|| defined(PORTNAME_hpux) \
-|| defined(PORTNAME_next)\
-|| defined(WIN32)
+#if defined(PORTNAME_hpux) || \
+    defined(PORTNAME_linux) || \
+    defined(PORTNAME_next) || \
+    defined(WIN32)
 typedef jmp_buf                ExcContext;
 #else
 typedef sigjmp_buf     ExcContext;