Module Name: src Committed By: christos Date: Fri Nov 29 21:57:31 UTC 2013
Modified Files: src/external/bsd/nvi/dist/common: vi_db1.c Log Message: make the debugging code work again. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/external/bsd/nvi/dist/common/vi_db1.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/bsd/nvi/dist/common/vi_db1.c diff -u src/external/bsd/nvi/dist/common/vi_db1.c:1.3 src/external/bsd/nvi/dist/common/vi_db1.c:1.4 --- src/external/bsd/nvi/dist/common/vi_db1.c:1.3 Mon Nov 25 17:43:46 2013 +++ src/external/bsd/nvi/dist/common/vi_db1.c Fri Nov 29 16:57:31 2013 @@ -120,30 +120,30 @@ db_get(SCR *sp, db_recno_t lno, u_int32_ l1 = TAILQ_FIRST(&sp->tiq)->lno; l2 = TAILQ_LAST(&sp->tiq, _texth)->lno; if (l1 <= lno && l2 >= lno) { -#if defined(DEBUG) && 0 - vtrace(sp, +#if defined(DBDEBUG) && defined(TRACE) + vtrace( "retrieve TEXT buffer line %lu\n", (u_long)lno); -#endif - for (tp = TAILQ_FIRST(&sp->tiq); - tp->lno != lno; tp = TAILQ_NEXT(tp, q)); - if (lenp != NULL) - *lenp = tp->len; - if (pp != NULL) - *pp = tp->lb; - return (0); - } - /* - * Adjust the line number for the number of lines used - * by the text input buffers. - */ - if (lno > l2) - lno -= l2 - l1; - } + #endif + for (tp = TAILQ_FIRST(&sp->tiq); + tp->lno != lno; tp = TAILQ_NEXT(tp, q)); + if (lenp != NULL) + *lenp = tp->len; + if (pp != NULL) + *pp = tp->lb; + return (0); + } + /* + * Adjust the line number for the number of lines used + * by the text input buffers. + */ + if (lno > l2) + lno -= l2 - l1; + } - /* Look-aside into the cache, and see if the line we want is there. */ - if (lno == sp->c_lno) { -#if defined(DEBUG) && 0 - vtrace(sp, "retrieve cached line %lu\n", (u_long)lno); + /* Look-aside into the cache, and see if the line we want is there. */ + if (lno == sp->c_lno) { + #if defined(DBDEBUG) && defined(TRACE) + vtrace("retrieve cached line %lu\n", (u_long)lno); #endif if (lenp != NULL) *lenp = sp->c_len; @@ -198,8 +198,8 @@ err3: if (lenp != NULL) sp->c_lno = lno; sp->c_len = wlen; -#if defined(DEBUG) && 0 - vtrace(sp, "retrieve DB line %lu\n", (u_long)lno); +#if defined(DBDEBUG) && defined(TRACE) + vtrace("retrieve DB line %lu\n", (u_long)lno); #endif if (lenp != NULL) *lenp = wlen; @@ -220,8 +220,8 @@ db_delete(SCR *sp, db_recno_t lno) DBT key; EXF *ep; -#if defined(DEBUG) && 0 - vtrace(sp, "delete line %lu\n", (u_long)lno); +#if defined(DBDEBUG) && defined(TRACE) + vtrace("delete line %lu\n", (u_long)lno); #endif /* Check for no underlying file. */ if ((ep = sp->ep) == NULL) { @@ -285,8 +285,8 @@ db_append(SCR *sp, int update, db_recno_ size_t flen; int rval; -#if defined(DEBUG) && 0 - vtrace(sp, "append to %lu: len %u {%.*s}\n", lno, len, MIN(len, 20), p); +#if defined(DBDEBUG) && defined(TRACE) + vtrace("append to %lu: len %u {%.*s}\n", lno, len, MIN(len, 20), p); #endif /* Check for no underlying file. */ if ((ep = sp->ep) == NULL) { @@ -360,8 +360,8 @@ db_insert(SCR *sp, db_recno_t lno, CHAR_ size_t flen; int rval; -#if defined(DEBUG) && 0 - vtrace(sp, "insert before %lu: len %lu {%.*s}\n", +#if defined(DBDEBUG) && defined(TRACE) + vtrace("insert before %lu: len %lu {%.*s}\n", (u_long)lno, (u_long)len, MIN(len, 20), p); #endif /* Check for no underlying file. */ @@ -426,8 +426,8 @@ db_set(SCR *sp, db_recno_t lno, CHAR_T * const char *fp; size_t flen; -#if defined(DEBUG) && 0 - vtrace(sp, "replace line %lu: len %lu {%.*s}\n", +#if defined(DBDEBUG) && defined(TRACE) + vtrace("replace line %lu: len %lu {%.*s}\n", (u_long)lno, (u_long)len, MIN(len, 20), p); #endif /* Check for no underlying file. */