reorder

Un outil pour réarranger les lignes de stdin - retour accueil

git clone git://bebou.netlib.re/reorder
Log | Files | Refs | README |

commit 1811dda62d234b46db5cbe463caadbb0ff80fb28
parent ca6496559b1bd10a71c0700b3924ef35a19a1fdb
Auteurice: Arthur Pons <arthur.pons@unistra.fr>
Date:   Thu, 16 Jan 2025 16:51:52 +0100

Pas besoin de realloc ?

On prévoit une taille max de 100 cartes ce qui devrait très évidemment
jamais être dépassé donc c'est ok ?

Diffstat:
Mreorder.c | 12------------
1 file changed, 0 insertions(+), 12 deletions(-)

diff --git a/reorder.c b/reorder.c @@ -20,10 +20,6 @@ int main(int argc, char **argv) { hand[handLineCount] = malloc(256); strcpy(hand[handLineCount], line); handLineCount++; - if(handLineCount > sizeof(hand)){ - listSize *= 2; - hand = realloc(hand, listSize); - } } for(int i = 0; i < handLineCount; i++){ printf("%s", hand[i]); @@ -117,10 +113,6 @@ int main(int argc, char **argv) { hand[handLineCount] = malloc(256); strcpy(hand[handLineCount], played[curline]); handLineCount++; - if(handLineCount > sizeof(hand)){ - listSize *= 2; - hand = realloc(hand, listSize); - } playedLineCount--; for(int w=curline;w<playedLineCount;w++) { played[w]=played[w+1]; @@ -137,10 +129,6 @@ int main(int argc, char **argv) { played[playedLineCount] = malloc(256); strcpy(played[playedLineCount], hand[curline]); playedLineCount++; - if(playedLineCount > sizeof(played)){ - listSize *= 2; - played = realloc(played, listSize); - } handLineCount--; for(int w=curline;w<handLineCount;w++) { hand[w]=hand[w+1];