RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  [email protected]
  Module: rpm                              Date:   12-Apr-2010 20:29:55
  Branch: HEAD                             Handle: 2010041218295400

  Modified files:
    rpm/rpmio               rpmsql.c

  Log:
    - rpmsql: WIP.

  Summary:
    Revision    Changes     Path
    2.34        +14 -10     rpm/rpmio/rpmsql.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmsql.c
  ============================================================================
  $ cvs diff -u -r2.33 -r2.34 rpmsql.c
  --- rpm/rpmio/rpmsql.c        12 Apr 2010 18:10:20 -0000      2.33
  +++ rpm/rpmio/rpmsql.c        12 Apr 2010 18:29:54 -0000      2.34
  @@ -2393,10 +2393,7 @@
   
   SQLDBG((stderr, "--> %s(%s)\n", __FUNCTION__, zPrior));
   
  -assert(sql->buf == NULL);
  -sql->nbuf = BUFSIZ;
  -sql->buf = xmalloc(sql->nbuf);
  -
  +assert(sql->buf != NULL);
   assert(sql->ifd != NULL);
   
       if (!F_ISSET(sql, PROMPT)) {
  @@ -2410,9 +2407,6 @@
   #endif
       }
   
  -sql->buf = _free(sql->buf);
  -sql->nbuf = 0;
  -
   SQLDBG((stderr, "<-- %s(%s)\n", __FUNCTION__, zPrior));
   
       return zResult;
  @@ -3767,16 +3761,22 @@
       int lineno = 0;
       int startline = 0;
   
  +char * _buf = sql->buf;
  +size_t _nbuf = sql->nbuf;
  +
   SQLDBG((stderr, "--> %s(%p)\n", __FUNCTION__, sql));
   if (_rpmsql_debug < 0)
   rpmsqlDebugDump(sql);
   
  +sql->nbuf = BUFSIZ;
  +sql->buf = xmalloc(sql->nbuf);
  +
       while (errCnt == 0 || !F_ISSET(sql, BAIL) || F_ISSET(sql, PROMPT))
       {
        if (sql->ofd) Fflush(sql->ofd);
        zLine = _free(zLine);
        zLine = rpmsqlInputOneLine(sql, zSql);
  -     if (zLine == 0)
  +     if (zLine == NULL)
            break;              /* We have reached EOF */
        if (_rpmsqlSeenInterrupt) {
            if (!F_ISSET(sql, PROMPT))
  @@ -3784,7 +3784,7 @@
            _rpmsqlSeenInterrupt = 0;
        }
        lineno++;
  -     if ((zSql == 0 || zSql[0] == 0) && _all_whitespace(zLine))
  +     if ((zSql == NULL || zSql[0] == '\0') && _all_whitespace(zLine))
            continue;
        if (zLine && zLine[0] == '.' && nSql == 0) {
            if (F_ISSET(sql, ECHO))
  @@ -3799,7 +3799,7 @@
        if (_is_command_terminator(zLine) && _is_complete(zSql, nSql))
            memcpy(zLine, ";", 2);
        nSqlPrior = nSql;
  -     if (zSql == 0) {
  +     if (zSql == NULL) {
            int i;
            for (i = 0; zLine[i] && xisspace((unsigned char) zLine[i]); i++)
                ;
  @@ -3847,6 +3847,10 @@
       }
       zLine = _free(zLine);
   
  +sql->buf = _free(sql->buf);
  +sql->buf = _buf;
  +sql->nbuf = _nbuf;
  +
   SQLDBG((stderr, "<-- %s(%p) rc %d\n", __FUNCTION__, sql, errCnt));
   
       return errCnt;
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                [email protected]

Reply via email to