Commit 8e34978
connect: move no_fork fallback to git_tcp_connect
git_connect has the structure
struct child_process *conn = &no_fork;
...
switch (protocol) {
case PROTO_GIT:
if (git_use_proxy(hostandport))
conn = git_proxy_connect(fd, hostandport);
else
git_tcp_connect(fd, hostandport, flags);
...
break;
case PROTO_SSH:
conn = xmalloc(sizeof(*conn));
child_process_init(conn);
argv_array_push(&conn->args, ssh);
...
break;
...
return conn;
In all cases except the git_tcp_connect case, conn is explicitly
assigned a value. Make the code clearer by explicitly assigning
'conn = &no_fork' in the tcp case and eliminating the default so the
compiler can ensure conn is always correctly assigned.
Noticed-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>1 parent 8339805 commit 8e34978
1 file changed
Lines changed: 21 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
582 | 582 | | |
583 | 583 | | |
584 | 584 | | |
585 | | - | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
586 | 597 | | |
587 | 598 | | |
588 | 599 | | |
589 | 600 | | |
590 | 601 | | |
| 602 | + | |
| 603 | + | |
591 | 604 | | |
592 | 605 | | |
593 | 606 | | |
| |||
761 | 774 | | |
762 | 775 | | |
763 | 776 | | |
764 | | - | |
765 | | - | |
766 | 777 | | |
767 | 778 | | |
768 | 779 | | |
| |||
851 | 862 | | |
852 | 863 | | |
853 | 864 | | |
854 | | - | |
855 | | - | |
856 | | - | |
857 | | - | |
858 | | - | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
859 | 870 | | |
860 | 871 | | |
861 | 872 | | |
| |||
865 | 876 | | |
866 | 877 | | |
867 | 878 | | |
868 | | - | |
| 879 | + | |
869 | 880 | | |
870 | 881 | | |
871 | 882 | | |
| |||
901 | 912 | | |
902 | 913 | | |
903 | 914 | | |
904 | | - | |
| 915 | + | |
905 | 916 | | |
906 | 917 | | |
907 | 918 | | |
| |||
1041 | 1052 | | |
1042 | 1053 | | |
1043 | 1054 | | |
1044 | | - | |
1045 | | - | |
1046 | | - | |
1047 | | - | |
1048 | | - | |
1049 | 1055 | | |
1050 | 1056 | | |
1051 | 1057 | | |
| |||
0 commit comments