forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commite0f05cd
committed
Improve some ancient, crufty code in bootstrap + initdb.
At some point back in the last century, somebody felt that readingall of pg_type twice was cheaper, or at least easier, than usingrepalloc() to resize the Typ[] array dynamically. That seems like anentirely wacko proposition, so rewrite the code to do it the otherway. (To add insult to injury, there were two not-quite-identicalcopies of said code.)initdb.c's readfile() function had the same disease of preferringto do double the I/O to avoid resizing its output array. Here,we can make things easier by using the just-invented pg_get_line()function to handle reading individual lines without a predeterminednotion of how long they are.On my machine, it's difficult to detect any net change in theoverall runtime of initdb from these changes; but they shouldhelp on slower buildfarm machines (especially since a buildfarmcycle involves a lot of initdb's these days).My attention was drawn to these places by scan-build complaints,but on inspection they needed a lot more work than just suppressingdead stores :-(1 parenta5cc4da commite0f05cd
2 files changed
+74
-91
lines changedLines changed: 60 additions & 59 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
53 | 53 |
| |
54 | 54 |
| |
55 | 55 |
| |
56 |
| - | |
57 |
| - | |
58 |
| - | |
59 | 56 |
| |
60 | 57 |
| |
61 | 58 |
| |
62 | 59 |
| |
63 | 60 |
| |
| 61 | + | |
64 | 62 |
| |
65 | 63 |
| |
66 | 64 |
| |
| |||
583 | 581 |
| |
584 | 582 |
| |
585 | 583 |
| |
| 584 | + | |
| 585 | + | |
586 | 586 |
| |
587 | 587 |
| |
588 | 588 |
| |
589 | 589 |
| |
590 | 590 |
| |
591 | 591 |
| |
592 |
| - | |
593 |
| - | |
594 |
| - | |
595 |
| - | |
596 | 592 |
| |
597 | 593 |
| |
598 | 594 |
| |
599 | 595 |
| |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
600 | 600 |
| |
601 |
| - | |
602 |
| - | |
603 |
| - | |
604 |
| - | |
605 |
| - | |
606 |
| - | |
607 |
| - | |
608 |
| - | |
609 |
| - | |
610 |
| - | |
611 |
| - | |
612 |
| - | |
613 |
| - | |
614 |
| - | |
615 |
| - | |
616 |
| - | |
617 |
| - | |
618 |
| - | |
619 |
| - | |
620 |
| - | |
621 |
| - | |
622 |
| - | |
623 |
| - | |
624 |
| - | |
625 |
| - | |
| 601 | + | |
626 | 602 |
| |
627 | 603 |
| |
628 | 604 |
| |
| |||
889 | 865 |
| |
890 | 866 |
| |
891 | 867 |
| |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
892 | 914 |
| |
893 | 915 |
| |
894 | 916 |
| |
| |||
903 | 925 |
| |
904 | 926 |
| |
905 | 927 |
| |
906 |
| - | |
907 |
| - | |
908 |
| - | |
909 |
| - | |
910 |
| - | |
911 |
| - | |
912 | 928 |
| |
913 | 929 |
| |
| 930 | + | |
| 931 | + | |
914 | 932 |
| |
915 | 933 |
| |
916 | 934 |
| |
| |||
922 | 940 |
| |
923 | 941 |
| |
924 | 942 |
| |
| 943 | + | |
| 944 | + | |
925 | 945 |
| |
926 | 946 |
| |
927 | 947 |
| |
928 | 948 |
| |
929 | 949 |
| |
| 950 | + | |
930 | 951 |
| |
931 |
| - | |
932 |
| - | |
933 |
| - | |
934 |
| - | |
935 |
| - | |
936 |
| - | |
937 |
| - | |
938 |
| - | |
939 |
| - | |
940 |
| - | |
941 |
| - | |
942 |
| - | |
943 |
| - | |
944 |
| - | |
945 |
| - | |
946 |
| - | |
947 |
| - | |
948 |
| - | |
949 |
| - | |
950 |
| - | |
951 |
| - | |
| 952 | + | |
952 | 953 |
| |
953 | 954 |
| |
954 | 955 |
| |
|
Lines changed: 14 additions & 32 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
468 | 468 |
| |
469 | 469 |
| |
470 | 470 |
| |
| 471 | + | |
471 | 472 |
| |
472 |
| - | |
473 |
| - | |
474 |
| - | |
| 473 | + | |
475 | 474 |
| |
476 |
| - | |
477 |
| - | |
478 |
| - | |
| 475 | + | |
479 | 476 |
| |
480 | 477 |
| |
481 | 478 |
| |
482 | 479 |
| |
483 | 480 |
| |
484 | 481 |
| |
485 | 482 |
| |
486 |
| - | |
| 483 | + | |
| 484 | + | |
487 | 485 |
| |
488 |
| - | |
| 486 | + | |
| 487 | + | |
489 | 488 |
| |
490 |
| - | |
491 |
| - | |
| 489 | + | |
| 490 | + | |
492 | 491 |
| |
493 |
| - | |
494 |
| - | |
495 |
| - | |
496 |
| - | |
| 492 | + | |
| 493 | + | |
497 | 494 |
| |
498 |
| - | |
499 |
| - | |
500 |
| - | |
501 |
| - | |
502 |
| - | |
503 |
| - | |
504 |
| - | |
505 | 495 |
| |
506 |
| - | |
507 |
| - | |
508 |
| - | |
509 |
| - | |
510 |
| - | |
511 |
| - | |
512 |
| - | |
513 |
| - | |
514 |
| - | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
515 | 499 |
| |
516 | 500 |
| |
517 |
| - | |
518 |
| - | |
519 | 501 |
| |
520 | 502 |
| |
521 | 503 |
| |
|
0 commit comments
Comments
(0)