summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-07-25 08:28:19 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-07-25 08:28:19 +0300
commita81b43d33c7b37996cd04c527917c3651c5cdc65 (patch)
treeab94ccdf763ccf9448dc832f2ce0ec4d582f7546
parent534ca653e54f417f413a65a9eacd71eb12c51326 (diff)
App: Maximum number of history items
-rw-r--r--src/app.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/app.c b/src/app.c
index 4c9a3477..83619a9c 100644
--- a/src/app.c
+++ b/src/app.c
@@ -55,7 +55,7 @@ static const char *dataDir_App_ = "~/.config/lagrange";
55#endif 55#endif
56static const char *prefsFileName_App_ = "prefs.cfg"; 56static const char *prefsFileName_App_ = "prefs.cfg";
57 57
58static const int HISTORY_MAX = 100; 58static const size_t HISTORY_MAX = 100;
59 59
60struct Impl_App { 60struct Impl_App {
61 iCommandLine args; 61 iCommandLine args;
@@ -384,6 +384,11 @@ iBool handleCommand_App(const char *cmd) {
384 init_HistoryItem(&item); 384 init_HistoryItem(&item);
385 set_String(&item.url, url); 385 set_String(&item.url, url);
386 pushBack_Array(&d->history, &item); 386 pushBack_Array(&d->history, &item);
387 /* Don't make it too long. */
388 if (size_Array(&d->history) > HISTORY_MAX) {
389 deinit_HistoryItem(front_Array(&d->history));
390 remove_Array(&d->history, 0);
391 }
387 } 392 }
388 } 393 }
389 printHistory_App_(d); 394 printHistory_App_(d);