@@ -58,7 +58,7 @@ typedef struct {
5858 * may be NULL. The cache makes it easy to load this and check
5959 * if it has been modified since the last load and/or write.
6060 */
61- int git_sortedcache_new (
61+ GIT_WARN_UNUSED_RESULT int git_sortedcache_new (
6262 git_sortedcache * * out ,
6363 size_t item_path_offset , /* use offsetof(struct, path-field) macro */
6464 git_sortedcache_free_item_fn free_item ,
@@ -71,7 +71,7 @@ int git_sortedcache_new(
7171 * - `copy_item` can be NULL to just use memcpy
7272 * - if `lock`, grabs read lock on `src` during copy and releases after
7373 */
74- int git_sortedcache_copy (
74+ GIT_WARN_UNUSED_RESULT int git_sortedcache_copy (
7575 git_sortedcache * * out ,
7676 git_sortedcache * src ,
7777 bool lock ,
@@ -100,7 +100,7 @@ const char *git_sortedcache_path(git_sortedcache *sc);
100100 */
101101
102102/* Lock sortedcache for write */
103- int git_sortedcache_wlock (git_sortedcache * sc );
103+ GIT_WARN_UNUSED_RESULT int git_sortedcache_wlock (git_sortedcache * sc );
104104
105105/* Unlock sorted cache when done with write */
106106void git_sortedcache_wunlock (git_sortedcache * sc );
@@ -120,7 +120,8 @@ void git_sortedcache_wunlock(git_sortedcache *sc);
120120 *
121121 * @return 0 if up-to-date, 1 if out-of-date, <0 on error
122122 */
123- int git_sortedcache_lockandload (git_sortedcache * sc , git_buf * buf );
123+ GIT_WARN_UNUSED_RESULT int git_sortedcache_lockandload (
124+ git_sortedcache * sc , git_buf * buf );
124125
125126/* Refresh file timestamp after write completes
126127 * You should already be holding the write lock when you call this.
@@ -132,12 +133,13 @@ void git_sortedcache_updated(git_sortedcache *sc);
132133 * If `wlock` is true, grabs write lock and releases when done, otherwise
133134 * you should already be holding a write lock when you call this.
134135 */
135- int git_sortedcache_clear (git_sortedcache * sc , bool wlock );
136+ GIT_WARN_UNUSED_RESULT int git_sortedcache_clear (
137+ git_sortedcache * sc , bool wlock );
136138
137139/* Find and/or insert item, returning pointer to item data.
138140 * You should already be holding the write lock when you call this.
139141 */
140- int git_sortedcache_upsert (
142+ GIT_WARN_UNUSED_RESULT int git_sortedcache_upsert (
141143 void * * out , git_sortedcache * sc , const char * key );
142144
143145/* Removes entry at pos from cache
@@ -155,7 +157,7 @@ int git_sortedcache_remove(git_sortedcache *sc, size_t pos);
155157 */
156158
157159/* Lock sortedcache for read */
158- int git_sortedcache_rlock (git_sortedcache * sc );
160+ GIT_WARN_UNUSED_RESULT int git_sortedcache_rlock (git_sortedcache * sc );
159161
160162/* Unlock sorted cache when done with read */
161163void git_sortedcache_runlock (git_sortedcache * sc );
0 commit comments