Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit298c457

Browse files
committed
Make dumpcolors() have tolerable performance when using 32-bit chr,
as we do (and upstream Tcl doesn't). The loop limit might be subjectto negotiation if anyone ever tries to do regex debugging in FarEastern languages, but for now 1000 seems plenty. CHR_MAX was right out :-(
1 parent06ce02f commit298c457

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

‎src/backend/regex/regc_color.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
2929
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3030
*
31-
* $PostgreSQL: pgsql/src/backend/regex/regc_color.c,v 1.5 2005/10/15 02:49:24 momjian Exp $
31+
* $PostgreSQL: pgsql/src/backend/regex/regc_color.c,v 1.6 2007/10/06 16:18:09 tgl Exp $
3232
*
3333
*
3434
* Note that there are some incestuous relationships between this code and
@@ -722,13 +722,17 @@ dumpcolors(struct colormap * cm,
722722
else
723723
fprintf(f,"#%2ld%s(%2d): ", (long)co,
724724
has,cd->nchrs);
725-
/* it's hard to do this more efficiently */
726-
for (c=CHR_MIN;c<CHR_MAX;c++)
725+
/*
726+
* Unfortunately, it's hard to do this next bit more efficiently.
727+
*
728+
* Spencer's original coding has the loop iterating from CHR_MIN
729+
* to CHR_MAX, but that's utterly unusable for 32-bit chr.
730+
* For debugging purposes it seems fine to print only chr
731+
* codes up to 1000 or so.
732+
*/
733+
for (c=CHR_MIN;c<1000;c++)
727734
if (GETCOLOR(cm,c)==co)
728735
dumpchr(c,f);
729-
assert(c==CHR_MAX);
730-
if (GETCOLOR(cm,c)==co)
731-
dumpchr(c,f);
732736
fprintf(f,"\n");
733737
}
734738
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp