• R/O
  • SSH
  • HTTPS

yash: 提交


Commit MetaInfo

修訂4182 (tree)
時間2021-12-18 15:34:48
作者magicant

Log Message

Mark nonnull attribute correctly

Change Summary

差異

--- yash/trunk/history.c (revision 4181)
+++ yash/trunk/history.c (revision 4182)
@@ -1,6 +1,6 @@
11 /* Yash: yet another shell */
22 /* history.c: command history management */
3-/* (C) 2007-2020 magicant */
3+/* (C) 2007-2021 magicant */
44
55 /* This program is free software: you can redistribute it and/or modify
66 * it under the terms of the GNU General Public License as published by
@@ -1174,8 +1174,8 @@
11741174 FC_FULL, FC_NUMBERED, FC_UNNUMBERED, FC_RAW,
11751175 };
11761176
1177-static struct search_result_T fc_search_entry(const wchar_t *name, int number)
1178- __attribute__((nonnull));
1177+static struct search_result_T fc_search_entry(
1178+ const wchar_t *prefix, int number);
11791179 static void fc_update_history(void);
11801180 static void fc_remove_last_entry(void);
11811181 static histlink_T *fc_search_entry_by_prefix(const wchar_t *prefix)
@@ -1360,14 +1360,17 @@
13601360 }
13611361
13621362 /* Searches for the specified entry.
1363+ * If `number` is not 0, the entry identified by the number is returned.
1364+ * Otherwise, an entry that begins with the `prefix' is returned, in which case
1365+ * non-NULL `prefix' must be given.
13631366 * The `prev' and `next' members of the returned structure will be `Histlist'
13641367 * if the prefix search fails. */
1365-struct search_result_T fc_search_entry(const wchar_t *name, int number)
1368+struct search_result_T fc_search_entry(const wchar_t *prefix, int number)
13661369 {
13671370 struct search_result_T result;
13681371
13691372 if (number == 0) {
1370- result.prev = result.next = fc_search_entry_by_prefix(name);
1373+ result.prev = result.next = fc_search_entry_by_prefix(prefix);
13711374 } else if (number > 0) {
13721375 result = search_entry_by_number((unsigned) number);
13731376 assert(result.prev != Histlist || result.next != Histlist);
--- yash/trunk/option.c (revision 4181)
+++ yash/trunk/option.c (revision 4182)
@@ -1,6 +1,6 @@
11 /* Yash: yet another shell */
22 /* option.c: option settings */
3-/* (C) 2007-2020 magicant */
3+/* (C) 2007-2021 magicant */
44
55 /* This program is free software: you can redistribute it and/or modify
66 * it under the terms of the GNU General Public License as published by
@@ -320,7 +320,7 @@
320320 static int handle_search_result(plist_T *options, void *const *argv,
321321 bool enable, size_t shelloptindex, size_t noshelloptindex,
322322 struct shell_invocation_T *shell_invocation)
323- __attribute__((nonnull));
323+ __attribute__((nonnull(1, 2)));
324324 static int set_shell_option(const struct option_T *option, bool enable,
325325 struct shell_invocation_T *shell_invocation)
326326 __attribute__((nonnull(1)));
Show on old repository browser