ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/ev.c
(Generate patch)

Comparing libev/ev.c (file contents):
Revision 1.24 by root, Wed Oct 31 20:46:44 2007 UTC vs.
Revision 1.28 by root, Thu Nov 1 06:48:49 2007 UTC

130/*****************************************************************************/ 130/*****************************************************************************/
131 131
132typedef struct 132typedef struct
133{ 133{
134 struct ev_io *head; 134 struct ev_io *head;
135 unsigned char wev, rev; /* want, received event set */ 135 int events;
136} ANFD; 136} ANFD;
137 137
138static ANFD *anfds; 138static ANFD *anfds;
139static int anfdmax; 139static int anfdmax;
140 140
141static int *fdchanges;
142static int fdchangemax, fdchangecnt;
143
144static void 141static void
145anfds_init (ANFD *base, int count) 142anfds_init (ANFD *base, int count)
146{ 143{
147 while (count--) 144 while (count--)
148 { 145 {
149 base->head = 0; 146 base->head = 0;
150 base->wev = base->rev = EV_NONE; 147 base->events = EV_NONE;
151 ++base; 148 ++base;
152 } 149 }
153} 150}
154 151
155typedef struct 152typedef struct
172 pendings [pendingcnt - 1].events = events; 169 pendings [pendingcnt - 1].events = events;
173 } 170 }
174} 171}
175 172
176static void 173static void
174queue_events (W *events, int eventcnt, int type)
175{
176 int i;
177
178 for (i = 0; i < eventcnt; ++i)
179 event (events [i], type);
180}
181
182static void
177fd_event (int fd, int events) 183fd_event (int fd, int events)
178{ 184{
179 ANFD *anfd = anfds + fd; 185 ANFD *anfd = anfds + fd;
180 struct ev_io *w; 186 struct ev_io *w;
181 187
186 if (ev) 192 if (ev)
187 event ((W)w, ev); 193 event ((W)w, ev);
188 } 194 }
189} 195}
190 196
197/*****************************************************************************/
198
199static int *fdchanges;
200static int fdchangemax, fdchangecnt;
201
191static void 202static void
192queue_events (W *events, int eventcnt, int type) 203fd_reify (void)
193{ 204{
194 int i; 205 int i;
195 206
196 for (i = 0; i < eventcnt; ++i) 207 for (i = 0; i < fdchangecnt; ++i)
197 event (events [i], type); 208 {
209 int fd = fdchanges [i];
210 ANFD *anfd = anfds + fd;
211 struct ev_io *w;
212
213 int events = 0;
214
215 for (w = anfd->head; w; w = w->next)
216 events |= w->events;
217
218 anfd->events &= ~EV_REIFY;
219
220 if (anfd->events != events)
221 {
222 method_modify (fd, anfd->events, events);
223 anfd->events = events;
224 }
225 }
226
227 fdchangecnt = 0;
228}
229
230static void
231fd_change (int fd)
232{
233 if (anfds [fd].events & EV_REIFY)
234 return;
235
236 anfds [fd].events |= EV_REIFY;
237
238 ++fdchangecnt;
239 array_needsize (fdchanges, fdchangemax, fdchangecnt, );
240 fdchanges [fdchangecnt - 1] = fd;
198} 241}
199 242
200/* called on EBADF to verify fds */ 243/* called on EBADF to verify fds */
201static void 244static void
202fd_recheck (void) 245fd_recheck (void)
203{ 246{
204 int fd; 247 int fd;
205 248
206 for (fd = 0; fd < anfdmax; ++fd) 249 for (fd = 0; fd < anfdmax; ++fd)
207 if (anfds [fd].wev) 250 if (anfds [fd].events)
208 if (fcntl (fd, F_GETFD) == -1 && errno == EBADF) 251 if (fcntl (fd, F_GETFD) == -1 && errno == EBADF)
209 while (anfds [fd].head) 252 while (anfds [fd].head)
210 { 253 {
211 event ((W)anfds [fd].head, EV_ERROR); 254 event ((W)anfds [fd].head, EV_ERROR);
212 evio_stop (anfds [fd].head); 255 ev_io_stop (anfds [fd].head);
213 } 256 }
214} 257}
215 258
216/*****************************************************************************/ 259/*****************************************************************************/
217 260
327 370
328 /* rather than sort out wether we really need nb, set it */ 371 /* rather than sort out wether we really need nb, set it */
329 fcntl (sigpipe [0], F_SETFL, O_NONBLOCK); 372 fcntl (sigpipe [0], F_SETFL, O_NONBLOCK);
330 fcntl (sigpipe [1], F_SETFL, O_NONBLOCK); 373 fcntl (sigpipe [1], F_SETFL, O_NONBLOCK);
331 374
332 evio_set (&sigev, sigpipe [0], EV_READ); 375 ev_io_set (&sigev, sigpipe [0], EV_READ);
333 evio_start (&sigev); 376 ev_io_start (&sigev);
334} 377}
335 378
336/*****************************************************************************/ 379/*****************************************************************************/
337 380
338static struct ev_idle **idles; 381static struct ev_idle **idles;
416 if (ev_method == EVMETHOD_NONE) select_init (flags); 459 if (ev_method == EVMETHOD_NONE) select_init (flags);
417#endif 460#endif
418 461
419 if (ev_method) 462 if (ev_method)
420 { 463 {
421 evw_init (&sigev, sigcb); 464 ev_watcher_init (&sigev, sigcb);
422 siginit (); 465 siginit ();
423 466
424 evsignal_init (&childev, childcb, SIGCHLD); 467 ev_signal_init (&childev, childcb, SIGCHLD);
425 evsignal_start (&childev); 468 ev_signal_start (&childev);
426 } 469 }
427 } 470 }
428 471
429 return ev_method; 472 return ev_method;
430} 473}
449#if HAVE_EPOLL 492#if HAVE_EPOLL
450 if (ev_method == EVMETHOD_EPOLL) 493 if (ev_method == EVMETHOD_EPOLL)
451 epoll_postfork_child (); 494 epoll_postfork_child ();
452#endif 495#endif
453 496
454 evio_stop (&sigev); 497 ev_io_stop (&sigev);
455 close (sigpipe [0]); 498 close (sigpipe [0]);
456 close (sigpipe [1]); 499 close (sigpipe [1]);
457 pipe (sigpipe); 500 pipe (sigpipe);
458 siginit (); 501 siginit ();
459} 502}
460 503
461/*****************************************************************************/ 504/*****************************************************************************/
462 505
463static void 506static void
464fd_reify (void)
465{
466 int i;
467
468 for (i = 0; i < fdchangecnt; ++i)
469 {
470 int fd = fdchanges [i];
471 ANFD *anfd = anfds + fd;
472 struct ev_io *w;
473
474 int wev = 0;
475
476 for (w = anfd->head; w; w = w->next)
477 wev |= w->events;
478
479 if (anfd->wev != wev)
480 {
481 method_modify (fd, anfd->wev, wev);
482 anfd->wev = wev;
483 }
484 }
485
486 fdchangecnt = 0;
487}
488
489static void
490call_pending (void) 507call_pending (void)
491{ 508{
492 while (pendingcnt) 509 while (pendingcnt)
493 { 510 {
494 ANPENDING *p = pendings + --pendingcnt; 511 ANPENDING *p = pendings + --pendingcnt;
516 w->at = now + w->repeat; 533 w->at = now + w->repeat;
517 assert (("timer timeout in the past, negative repeat?", w->at > now)); 534 assert (("timer timeout in the past, negative repeat?", w->at > now));
518 downheap ((WT *)timers, timercnt, 0); 535 downheap ((WT *)timers, timercnt, 0);
519 } 536 }
520 else 537 else
521 evtimer_stop (w); /* nonrepeating: stop timer */ 538 ev_timer_stop (w); /* nonrepeating: stop timer */
522 } 539 }
523} 540}
524 541
525static void 542static void
526periodics_reify (void) 543periodics_reify (void)
535 w->at += floor ((ev_now - w->at) / w->interval + 1.) * w->interval; 552 w->at += floor ((ev_now - w->at) / w->interval + 1.) * w->interval;
536 assert (("periodic timeout in the past, negative interval?", w->at > ev_now)); 553 assert (("periodic timeout in the past, negative interval?", w->at > ev_now));
537 downheap ((WT *)periodics, periodiccnt, 0); 554 downheap ((WT *)periodics, periodiccnt, 0);
538 } 555 }
539 else 556 else
540 evperiodic_stop (w); /* nonrepeating: stop timer */ 557 ev_periodic_stop (w); /* nonrepeating: stop timer */
541 558
542 event ((W)w, EV_TIMEOUT); 559 event ((W)w, EV_TIMEOUT);
543 } 560 }
544} 561}
545 562
557 { 574 {
558 ev_tstamp diff = ceil ((ev_now - w->at) / w->interval) * w->interval; 575 ev_tstamp diff = ceil ((ev_now - w->at) / w->interval) * w->interval;
559 576
560 if (fabs (diff) >= 1e-4) 577 if (fabs (diff) >= 1e-4)
561 { 578 {
562 evperiodic_stop (w); 579 ev_periodic_stop (w);
563 evperiodic_start (w); 580 ev_periodic_start (w);
564 581
565 i = 0; /* restart loop, inefficient, but time jumps should be rare */ 582 i = 0; /* restart loop, inefficient, but time jumps should be rare */
566 } 583 }
567 } 584 }
568 } 585 }
611int ev_loop_done; 628int ev_loop_done;
612 629
613void ev_loop (int flags) 630void ev_loop (int flags)
614{ 631{
615 double block; 632 double block;
616 ev_loop_done = flags & EVLOOP_ONESHOT ? 1 : 0; 633 ev_loop_done = flags & (EVLOOP_ONESHOT | EVLOOP_NONBLOCK) ? 1 : 0;
617 634
618 do 635 do
619 { 636 {
620 /* queue check watchers (and execute them) */ 637 /* queue check watchers (and execute them) */
621 if (preparecnt) 638 if (preparecnt)
726} 743}
727 744
728/*****************************************************************************/ 745/*****************************************************************************/
729 746
730void 747void
731evio_start (struct ev_io *w) 748ev_io_start (struct ev_io *w)
732{ 749{
733 if (ev_is_active (w)) 750 if (ev_is_active (w))
734 return; 751 return;
735 752
736 int fd = w->fd; 753 int fd = w->fd;
737 754
738 ev_start ((W)w, 1); 755 ev_start ((W)w, 1);
739 array_needsize (anfds, anfdmax, fd + 1, anfds_init); 756 array_needsize (anfds, anfdmax, fd + 1, anfds_init);
740 wlist_add ((WL *)&anfds[fd].head, (WL)w); 757 wlist_add ((WL *)&anfds[fd].head, (WL)w);
741 758
742 ++fdchangecnt; 759 fd_change (fd);
743 array_needsize (fdchanges, fdchangemax, fdchangecnt, );
744 fdchanges [fdchangecnt - 1] = fd;
745} 760}
746 761
747void 762void
748evio_stop (struct ev_io *w) 763ev_io_stop (struct ev_io *w)
749{ 764{
750 ev_clear ((W)w); 765 ev_clear ((W)w);
751 if (!ev_is_active (w)) 766 if (!ev_is_active (w))
752 return; 767 return;
753 768
754 wlist_del ((WL *)&anfds[w->fd].head, (WL)w); 769 wlist_del ((WL *)&anfds[w->fd].head, (WL)w);
755 ev_stop ((W)w); 770 ev_stop ((W)w);
756 771
757 ++fdchangecnt; 772 fd_change (w->fd);
758 array_needsize (fdchanges, fdchangemax, fdchangecnt, );
759 fdchanges [fdchangecnt - 1] = w->fd;
760} 773}
761 774
762void 775void
763evtimer_start (struct ev_timer *w) 776ev_timer_start (struct ev_timer *w)
764{ 777{
765 if (ev_is_active (w)) 778 if (ev_is_active (w))
766 return; 779 return;
767 780
768 w->at += now; 781 w->at += now;
774 timers [timercnt - 1] = w; 787 timers [timercnt - 1] = w;
775 upheap ((WT *)timers, timercnt - 1); 788 upheap ((WT *)timers, timercnt - 1);
776} 789}
777 790
778void 791void
779evtimer_stop (struct ev_timer *w) 792ev_timer_stop (struct ev_timer *w)
780{ 793{
781 ev_clear ((W)w); 794 ev_clear ((W)w);
782 if (!ev_is_active (w)) 795 if (!ev_is_active (w))
783 return; 796 return;
784 797
792 805
793 ev_stop ((W)w); 806 ev_stop ((W)w);
794} 807}
795 808
796void 809void
797evtimer_again (struct ev_timer *w) 810ev_timer_again (struct ev_timer *w)
798{ 811{
799 if (ev_is_active (w)) 812 if (ev_is_active (w))
800 { 813 {
801 if (w->repeat) 814 if (w->repeat)
802 { 815 {
803 w->at = now + w->repeat; 816 w->at = now + w->repeat;
804 downheap ((WT *)timers, timercnt, w->active - 1); 817 downheap ((WT *)timers, timercnt, w->active - 1);
805 } 818 }
806 else 819 else
807 evtimer_stop (w); 820 ev_timer_stop (w);
808 } 821 }
809 else if (w->repeat) 822 else if (w->repeat)
810 evtimer_start (w); 823 ev_timer_start (w);
811} 824}
812 825
813void 826void
814evperiodic_start (struct ev_periodic *w) 827ev_periodic_start (struct ev_periodic *w)
815{ 828{
816 if (ev_is_active (w)) 829 if (ev_is_active (w))
817 return; 830 return;
818 831
819 assert (("periodic interval value less than zero not allowed", w->interval >= 0.)); 832 assert (("periodic interval value less than zero not allowed", w->interval >= 0.));
827 periodics [periodiccnt - 1] = w; 840 periodics [periodiccnt - 1] = w;
828 upheap ((WT *)periodics, periodiccnt - 1); 841 upheap ((WT *)periodics, periodiccnt - 1);
829} 842}
830 843
831void 844void
832evperiodic_stop (struct ev_periodic *w) 845ev_periodic_stop (struct ev_periodic *w)
833{ 846{
834 ev_clear ((W)w); 847 ev_clear ((W)w);
835 if (!ev_is_active (w)) 848 if (!ev_is_active (w))
836 return; 849 return;
837 850
843 856
844 ev_stop ((W)w); 857 ev_stop ((W)w);
845} 858}
846 859
847void 860void
848evsignal_start (struct ev_signal *w) 861ev_signal_start (struct ev_signal *w)
849{ 862{
850 if (ev_is_active (w)) 863 if (ev_is_active (w))
851 return; 864 return;
852 865
853 ev_start ((W)w, 1); 866 ev_start ((W)w, 1);
863 sigaction (w->signum, &sa, 0); 876 sigaction (w->signum, &sa, 0);
864 } 877 }
865} 878}
866 879
867void 880void
868evsignal_stop (struct ev_signal *w) 881ev_signal_stop (struct ev_signal *w)
869{ 882{
870 ev_clear ((W)w); 883 ev_clear ((W)w);
871 if (!ev_is_active (w)) 884 if (!ev_is_active (w))
872 return; 885 return;
873 886
876 889
877 if (!signals [w->signum - 1].head) 890 if (!signals [w->signum - 1].head)
878 signal (w->signum, SIG_DFL); 891 signal (w->signum, SIG_DFL);
879} 892}
880 893
894void
881void evidle_start (struct ev_idle *w) 895ev_idle_start (struct ev_idle *w)
882{ 896{
883 if (ev_is_active (w)) 897 if (ev_is_active (w))
884 return; 898 return;
885 899
886 ev_start ((W)w, ++idlecnt); 900 ev_start ((W)w, ++idlecnt);
887 array_needsize (idles, idlemax, idlecnt, ); 901 array_needsize (idles, idlemax, idlecnt, );
888 idles [idlecnt - 1] = w; 902 idles [idlecnt - 1] = w;
889} 903}
890 904
905void
891void evidle_stop (struct ev_idle *w) 906ev_idle_stop (struct ev_idle *w)
892{ 907{
893 ev_clear ((W)w); 908 ev_clear ((W)w);
894 if (ev_is_active (w)) 909 if (ev_is_active (w))
895 return; 910 return;
896 911
897 idles [w->active - 1] = idles [--idlecnt]; 912 idles [w->active - 1] = idles [--idlecnt];
898 ev_stop ((W)w); 913 ev_stop ((W)w);
899} 914}
900 915
916void
901void evprepare_start (struct ev_prepare *w) 917ev_prepare_start (struct ev_prepare *w)
902{ 918{
903 if (ev_is_active (w)) 919 if (ev_is_active (w))
904 return; 920 return;
905 921
906 ev_start ((W)w, ++preparecnt); 922 ev_start ((W)w, ++preparecnt);
907 array_needsize (prepares, preparemax, preparecnt, ); 923 array_needsize (prepares, preparemax, preparecnt, );
908 prepares [preparecnt - 1] = w; 924 prepares [preparecnt - 1] = w;
909} 925}
910 926
927void
911void evprepare_stop (struct ev_prepare *w) 928ev_prepare_stop (struct ev_prepare *w)
912{ 929{
913 ev_clear ((W)w); 930 ev_clear ((W)w);
914 if (ev_is_active (w)) 931 if (ev_is_active (w))
915 return; 932 return;
916 933
917 prepares [w->active - 1] = prepares [--preparecnt]; 934 prepares [w->active - 1] = prepares [--preparecnt];
918 ev_stop ((W)w); 935 ev_stop ((W)w);
919} 936}
920 937
938void
921void evcheck_start (struct ev_check *w) 939ev_check_start (struct ev_check *w)
922{ 940{
923 if (ev_is_active (w)) 941 if (ev_is_active (w))
924 return; 942 return;
925 943
926 ev_start ((W)w, ++checkcnt); 944 ev_start ((W)w, ++checkcnt);
927 array_needsize (checks, checkmax, checkcnt, ); 945 array_needsize (checks, checkmax, checkcnt, );
928 checks [checkcnt - 1] = w; 946 checks [checkcnt - 1] = w;
929} 947}
930 948
949void
931void evcheck_stop (struct ev_check *w) 950ev_check_stop (struct ev_check *w)
932{ 951{
933 ev_clear ((W)w); 952 ev_clear ((W)w);
934 if (ev_is_active (w)) 953 if (ev_is_active (w))
935 return; 954 return;
936 955
937 checks [w->active - 1] = checks [--checkcnt]; 956 checks [w->active - 1] = checks [--checkcnt];
938 ev_stop ((W)w); 957 ev_stop ((W)w);
939} 958}
940 959
960void
941void evchild_start (struct ev_child *w) 961ev_child_start (struct ev_child *w)
942{ 962{
943 if (ev_is_active (w)) 963 if (ev_is_active (w))
944 return; 964 return;
945 965
946 ev_start ((W)w, 1); 966 ev_start ((W)w, 1);
947 wlist_add ((WL *)&childs [w->pid & (PID_HASHSIZE - 1)], (WL)w); 967 wlist_add ((WL *)&childs [w->pid & (PID_HASHSIZE - 1)], (WL)w);
948} 968}
949 969
970void
950void evchild_stop (struct ev_child *w) 971ev_child_stop (struct ev_child *w)
951{ 972{
952 ev_clear ((W)w); 973 ev_clear ((W)w);
953 if (ev_is_active (w)) 974 if (ev_is_active (w))
954 return; 975 return;
955 976
971once_cb (struct ev_once *once, int revents) 992once_cb (struct ev_once *once, int revents)
972{ 993{
973 void (*cb)(int revents, void *arg) = once->cb; 994 void (*cb)(int revents, void *arg) = once->cb;
974 void *arg = once->arg; 995 void *arg = once->arg;
975 996
976 evio_stop (&once->io); 997 ev_io_stop (&once->io);
977 evtimer_stop (&once->to); 998 ev_timer_stop (&once->to);
978 free (once); 999 free (once);
979 1000
980 cb (revents, arg); 1001 cb (revents, arg);
981} 1002}
982 1003
1002 else 1023 else
1003 { 1024 {
1004 once->cb = cb; 1025 once->cb = cb;
1005 once->arg = arg; 1026 once->arg = arg;
1006 1027
1007 evw_init (&once->io, once_cb_io); 1028 ev_watcher_init (&once->io, once_cb_io);
1008 1029
1009 if (fd >= 0) 1030 if (fd >= 0)
1010 { 1031 {
1011 evio_set (&once->io, fd, events); 1032 ev_io_set (&once->io, fd, events);
1012 evio_start (&once->io); 1033 ev_io_start (&once->io);
1013 } 1034 }
1014 1035
1015 evw_init (&once->to, once_cb_to); 1036 ev_watcher_init (&once->to, once_cb_to);
1016 1037
1017 if (timeout >= 0.) 1038 if (timeout >= 0.)
1018 { 1039 {
1019 evtimer_set (&once->to, timeout, 0.); 1040 ev_timer_set (&once->to, timeout, 0.);
1020 evtimer_start (&once->to); 1041 ev_timer_start (&once->to);
1021 } 1042 }
1022 } 1043 }
1023} 1044}
1024 1045
1025/*****************************************************************************/ 1046/*****************************************************************************/
1036 1057
1037static void 1058static void
1038ocb (struct ev_timer *w, int revents) 1059ocb (struct ev_timer *w, int revents)
1039{ 1060{
1040 //fprintf (stderr, "timer %f,%f (%x) (%f) d%p\n", w->at, w->repeat, revents, w->at - ev_time (), w->data); 1061 //fprintf (stderr, "timer %f,%f (%x) (%f) d%p\n", w->at, w->repeat, revents, w->at - ev_time (), w->data);
1041 evtimer_stop (w); 1062 ev_timer_stop (w);
1042 evtimer_start (w); 1063 ev_timer_start (w);
1043} 1064}
1044 1065
1045static void 1066static void
1046scb (struct ev_signal *w, int revents) 1067scb (struct ev_signal *w, int revents)
1047{ 1068{
1048 fprintf (stderr, "signal %x,%d\n", revents, w->signum); 1069 fprintf (stderr, "signal %x,%d\n", revents, w->signum);
1049 evio_stop (&wio); 1070 ev_io_stop (&wio);
1050 evio_start (&wio); 1071 ev_io_start (&wio);
1051} 1072}
1052 1073
1053static void 1074static void
1054gcb (struct ev_signal *w, int revents) 1075gcb (struct ev_signal *w, int revents)
1055{ 1076{
1059 1080
1060int main (void) 1081int main (void)
1061{ 1082{
1062 ev_init (0); 1083 ev_init (0);
1063 1084
1064 evio_init (&wio, sin_cb, 0, EV_READ); 1085 ev_io_init (&wio, sin_cb, 0, EV_READ);
1065 evio_start (&wio); 1086 ev_io_start (&wio);
1066 1087
1067 struct ev_timer t[10000]; 1088 struct ev_timer t[10000];
1068 1089
1069#if 0 1090#if 0
1070 int i; 1091 int i;
1071 for (i = 0; i < 10000; ++i) 1092 for (i = 0; i < 10000; ++i)
1072 { 1093 {
1073 struct ev_timer *w = t + i; 1094 struct ev_timer *w = t + i;
1074 evw_init (w, ocb, i); 1095 ev_watcher_init (w, ocb, i);
1075 evtimer_init_abs (w, ocb, drand48 (), 0.99775533); 1096 ev_timer_init_abs (w, ocb, drand48 (), 0.99775533);
1076 evtimer_start (w); 1097 ev_timer_start (w);
1077 if (drand48 () < 0.5) 1098 if (drand48 () < 0.5)
1078 evtimer_stop (w); 1099 ev_timer_stop (w);
1079 } 1100 }
1080#endif 1101#endif
1081 1102
1082 struct ev_timer t1; 1103 struct ev_timer t1;
1083 evtimer_init (&t1, ocb, 5, 10); 1104 ev_timer_init (&t1, ocb, 5, 10);
1084 evtimer_start (&t1); 1105 ev_timer_start (&t1);
1085 1106
1086 struct ev_signal sig; 1107 struct ev_signal sig;
1087 evsignal_init (&sig, scb, SIGQUIT); 1108 ev_signal_init (&sig, scb, SIGQUIT);
1088 evsignal_start (&sig); 1109 ev_signal_start (&sig);
1089 1110
1090 struct ev_check cw; 1111 struct ev_check cw;
1091 evcheck_init (&cw, gcb); 1112 ev_check_init (&cw, gcb);
1092 evcheck_start (&cw); 1113 ev_check_start (&cw);
1093 1114
1094 struct ev_idle iw; 1115 struct ev_idle iw;
1095 evidle_init (&iw, gcb); 1116 ev_idle_init (&iw, gcb);
1096 evidle_start (&iw); 1117 ev_idle_start (&iw);
1097 1118
1098 ev_loop (0); 1119 ev_loop (0);
1099 1120
1100 return 0; 1121 return 0;
1101} 1122}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines