From a8075d93301c1c755d7528b169147dc90cb606f0 Mon Sep 17 00:00:00 2001 From: Kevin Schellberg Date: Tue, 6 Feb 2024 12:43:40 +0100 Subject: [PATCH] refactoring: Refactoring5 --- build/test/out/c/quizduell.o | Bin 13342 -> 13350 bytes build/test/out/test_quizduell.out | Bin 131036 -> 131036 bytes build/test/results/test_casualQuiz.pass | 2 +- build/test/results/test_quizduell.pass | 2 +- build/test/results/test_timequiz.pass | 2 +- build/test/results/test_wwm.pass | 2 +- src/quizduell.c | 9 +++++++++ 7 files changed, 13 insertions(+), 4 deletions(-) diff --git a/build/test/out/c/quizduell.o b/build/test/out/c/quizduell.o index c8c2f5d0efa8ac61bf8b5a1e5cd4e397f0dea429..b0c72729b470550722dfa89112f2fe092b688cd4 100644 GIT binary patch delta 1307 zcmYjPO>7%g5T1GV+TLvK*j~Hq|FvV{R7H&xeoFsRf}o+1fl3@WAyLcOB&P1#T5nV} zm#8S>09=+w;Xp+%fCNPxaN$79|A9jRRYK|oDNqS<1F4h?7sSkNvhXB7f8RIX%)Gbr z-dcNiOK9G z>|F{L(;}-bB0y}#>8x5d=xJsU>)0EewfJGS@DzIF9;lkMKUp;< zUZ)`T;GJw++SS6z&zTO_?K7?gA7{8^#Jj!;%G;BaPwPbR$0=WDIV`*dk`hl7{DX4U z>%;`)G)=|o@>fZC8OSw7ixMbX#Fhu1AfMG&RO=dT!5_oewKX+UF3shm%>Hq)$ delta 1464 zcmYjPUuaup6hG%CH_7d7{@!HC&7Y=eZ0p}@H?^~)TgPm)bh@`OMU>dyHgPeD$*sdW ziGPYOP9*!-24m=p&L>fc6CCqF1brBSGAIs3Ecl=gDk2U95zo0_a_tBAe!ufO=lst1 zedk=Pyjjs!UJU`SQ(diy!`(aH!eia9j^MD!VP3oH1Ng}V*c1y`#P>xNC)JB%05`-L zEUH_ChQz1jd0TAbB>qbOxX396Ug=FMy=3r9N>>2`te+5nn1^wf*q=UxN%3-e9#i7; z^u&xAQDWLb1n{l4%4=2~j0jucE7v#5m0C%XajisT!1q++xYdG$RubcxJgQ8n=5yek zi(Mj?KgId+v0-S-5v~vNAMp6O*0vkP2X}55g4{Ff)s2;Pt5ySi$tS+e#)hwZ0Agv9 z*bHA6H?sSj=Tf?d@mcZWp2X5;K^9ZG_lNzm+wd>N^6F9|R^gqP40sU2cZH?r5xK!9 z9MN2_AGa;I6fKGKxsi+vo~MYwLnQnQg=kmEQos<`ayOX;FSR5>#KssyrArs&Ktn`E zraBe&@?qPz4ZQJovuf3>rLt|UHCj~*k}B6YN*}N1Rk`DZj|n--$ z44pYSYPC*S^%ctov+p>jzJg#lT5|)*Dr7<>@%6~9_pmm-kxV{Vw@)-$HWWfkd%Bl9 z;h(utv|i}%r^pc#cjhx#5=;3#yWgX6kG$5`b&MZ(7?c>`CVxSk^H>_h#RvI`(&LmC zb%r1Gac73R0q;0P>U*UX@lLVzu(VR%8MaoWHR_#bYr`wDqjUH2n+;Z>5AXsXrC-3G z`;%y;4bgJ{e*RmwdT)$|uyZ$fLbC+EDOh#6*IjhpMen-kI~OU`51AWr(TIy~chM{%zYMf{e@z`x L@M>>idRzGqAZz6@ diff --git a/build/test/out/test_quizduell.out b/build/test/out/test_quizduell.out index 8d8ff17c413d182bd2e0ead994785b1fa3731ace..5e3825f80f1f9178309d79f83fb488b52db37de9 100644 GIT binary patch delta 1116 zcmYjPU1$_%6utMGnVp@CoBf&H>~1#AYHXI$QjGsGKblqvhJ{!PEom#rvQ9Ru$?iJ4 z!5CXal7~t`9G5sRc`EIjBC*v)4dR2MwS5o^EfgF2(o*`MEiIJ3biH>bQ9qcEd+t5w z+&eS(aZ`QVRL^~imVM@c7eAKicreznBn8uccUASgU;%Li+1Vo*C0$)vLWB~bd z%FK3gC~SZhW=5SuzhcTsOK2RNVh#^mePfLit5%BUq?ygt%tF~Jnh;mG)%zcLGo4h3 zO$QfmQsnx_*RN{58F>*Pq0yKUCOW+_$CSBM{otCu2&vYrb4SA0@uu@s!nQs(lyj54{mKP{;=td6?A>>PCeqq6*<$sdl_<)j-|8(wI|lCVH(M-}EOlFk;Z_ zZUd>cZv*!0yYvx5B>1=O>B0_-IhQwLeCNkWBvxA(yZwePrBmrJM$}LoAa0mBvyRs%^NtalIFp29$?1SGN_ IJStPq0MF#waR2}S delta 1159 zcmYjQQD_`x5T5yW_x7&aOYU|rxw|AynluS$kk%MXY;8$3UJYW46oZ&xI4_&r+3Vf8 zw;^d-xd-#mq7QD5xG#MYg$jzK+8mWoN>STHpA;gISlWkzqM)E4zIe{;CeslVFZD6VIiH(r+jBDlp<#^@LKVdX+cvcwbYIss4N}9r3y!60U#cHVAmbWpq)(mT7{L6p=ypaS+;OOgocJTcCa>8aZXyF3y%pR4uR=XZ$Kt z*#NDaNf)L;4SB>ooZBhh09wh)6>N(Ajb0M>zfibrTba@skPquu$;(@KA8s3VZFq?b zJNjdi%C+u2U~%I@cCRD$?B0|B^p8le*tqHbhIj~5ZlA!8E|v&qq*2YnFn9V7ZC(xu zFb5y#DK{@L@$5CmrP;zM+k~r8R!Pok1(f%5zU~=c#+sYDpLCd9!RLwjGigJsgajDw zHv+qpoiaVZd*oT@VpBMD9A+Bs|xd<-Q$GtX#^OdGoonZO#;}oC$G- zOO1{DJ)BjDO$#rrkmco%@7>n=z4LrP!kY}?OrSR#W2QA{7N$%alG}lolsCu0U6D|y zTUwLw;TJd`-I6ajTCnGemJOW^?3SF*D~&%*_#M2#4@2v13g{Qfc(k2gNjS%G#-!KG zWwJD{{d-dGh>VZ*e@qh}d27O&i~^9s(#oCC^A3qBIm2S92#*olXpr-H0Ym> zVo%V}q>k2(DC%k?4$y3%rX18*$BcNG^LTL77@}h*dSTS4Eq9^XjQzE1L%95;@-?;A j<3=59sx8jqp8_w}&dlS51oqV=2fsr+S^NGXDyRPi{QByK diff --git a/build/test/results/test_casualQuiz.pass b/build/test/results/test_casualQuiz.pass index d83a877..b8eee11 100644 --- a/build/test/results/test_casualQuiz.pass +++ b/build/test/results/test_casualQuiz.pass @@ -11,4 +11,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.02078239998081699 +:time: 0.022334299981594086 diff --git a/build/test/results/test_quizduell.pass b/build/test/results/test_quizduell.pass index 317ba20..aa4b0ee 100644 --- a/build/test/results/test_quizduell.pass +++ b/build/test/results/test_quizduell.pass @@ -51,4 +51,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.021433699992485344 +:time: 0.039953699975740165 diff --git a/build/test/results/test_timequiz.pass b/build/test/results/test_timequiz.pass index 34a121c..9c3c852 100644 --- a/build/test/results/test_timequiz.pass +++ b/build/test/results/test_timequiz.pass @@ -11,4 +11,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.02030239999294281 +:time: 0.02081809999071993 diff --git a/build/test/results/test_wwm.pass b/build/test/results/test_wwm.pass index f7086df..eb16a2d 100644 --- a/build/test/results/test_wwm.pass +++ b/build/test/results/test_wwm.pass @@ -11,4 +11,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.021443899982841685 +:time: 0.019612700009020045 diff --git a/src/quizduell.c b/src/quizduell.c index 9cc7029..cf3aa2c 100644 --- a/src/quizduell.c +++ b/src/quizduell.c @@ -131,6 +131,9 @@ void quizduell() { Kategorie kategorien[MAX_CATEGORIES]; kategorien[0].fragen = (QuizFrage*)malloc(MAX_QUESTIONS_PER_CATEGORY * sizeof(QuizFrage)); + if (kategorien[0].fragen == NULL) { + exit(EXIT_FAILURE); + } kategorien[0].fragen[0] = erstelleFrage("Whats the height of the Zugspitze?", "2482 Meter", "2867 Meter", "2962 Meter", "3173 Meter", 'C'); kategorien[0].fragen[1] = erstelleFrage("In which Federal State is the Zugspitze?", "Bayern", "Baden-Wuerttemberg", "Hessen", "Thueringen", 'A'); kategorien[0].fragen[2] = erstelleFrage("Which Mountain is the highest following after the Zugspitze?", "Grossglockner", "Watzmann", "Feldberg", "Meissner", 'B'); @@ -138,6 +141,9 @@ void quizduell() { kategorien[0].joker = 1; kategorien[1].fragen = (QuizFrage*)malloc(MAX_QUESTIONS_PER_CATEGORY * sizeof(QuizFrage)); + if (kategorien[1].fragen == NULL) { + exit(EXIT_FAILURE); + } kategorien[1].fragen[0] = erstelleFrage("Which Ingredient is used traditionally for Pesto?", "Tomatoes", "Basil", "Spinach", "Oregano", 'B'); kategorien[1].fragen[1] = erstelleFrage("Which meal is known for its usage of rice?", "Lasagna", "Sushi", "Pizza", "Hamburger", 'B'); kategorien[1].fragen[2] = erstelleFrage("Which color has a ripe banana?", "Red", "Green", "Yellow", "Orange", 'C'); @@ -145,6 +151,9 @@ void quizduell() { kategorien[1].joker = 1; kategorien[2].fragen = (QuizFrage*)malloc(MAX_QUESTIONS_PER_CATEGORY * sizeof(QuizFrage)); + if (kategorien[2].fragen == NULL) { + exit(EXIT_FAILURE); + } kategorien[2].fragen[0] = erstelleFrage("In which sport is the term 'home run' used?", "Soccer/Football", "Baseball", "Tennis", "Golf", 'B'); kategorien[2].fragen[1] = erstelleFrage("How many players are there normally on the pitch in a soccer/football team?", "9", "11", "7", "5", 'B'); kategorien[2].fragen[2] = erstelleFrage("What sport is played on a pitch and has a 'wicket'?", "Rugby", "Cricket", "American Football", "Hockey", 'B');