Commit 4bb1568f by lhchavez

Be a little bit less aggressive GIT_WARN_UNUSED_RESULT

Now we're limiting ourselves to only functions that allocate or acquire
locks.
parent 231ca4fa
...@@ -88,7 +88,7 @@ void git_sortedcache_free(git_sortedcache *sc); ...@@ -88,7 +88,7 @@ void git_sortedcache_free(git_sortedcache *sc);
void git_sortedcache_incref(git_sortedcache *sc); void git_sortedcache_incref(git_sortedcache *sc);
/* Get the pathname associated with this cache at creation time */ /* Get the pathname associated with this cache at creation time */
GIT_WARN_UNUSED_RESULT const char *git_sortedcache_path(git_sortedcache *sc); const char *git_sortedcache_path(git_sortedcache *sc);
/* /*
* CACHE WRITE FUNCTIONS * CACHE WRITE FUNCTIONS
...@@ -145,7 +145,7 @@ GIT_WARN_UNUSED_RESULT int git_sortedcache_upsert( ...@@ -145,7 +145,7 @@ GIT_WARN_UNUSED_RESULT int git_sortedcache_upsert(
/* Removes entry at pos from cache /* Removes entry at pos from cache
* You should already be holding the write lock when you call this. * You should already be holding the write lock when you call this.
*/ */
GIT_WARN_UNUSED_RESULT int git_sortedcache_remove(git_sortedcache *sc, size_t pos); int git_sortedcache_remove(git_sortedcache *sc, size_t pos);
/* /*
* CACHE READ FUNCTIONS * CACHE READ FUNCTIONS
...@@ -163,23 +163,20 @@ GIT_WARN_UNUSED_RESULT int git_sortedcache_rlock(git_sortedcache *sc); ...@@ -163,23 +163,20 @@ GIT_WARN_UNUSED_RESULT int git_sortedcache_rlock(git_sortedcache *sc);
void git_sortedcache_runlock(git_sortedcache *sc); void git_sortedcache_runlock(git_sortedcache *sc);
/* Lookup item by key - returns NULL if not found */ /* Lookup item by key - returns NULL if not found */
GIT_WARN_UNUSED_RESULT void *git_sortedcache_lookup( void *git_sortedcache_lookup(const git_sortedcache *sc, const char *key);
const git_sortedcache *sc, const char *key);
/* Get how many items are in the cache /* Get how many items are in the cache
* *
* You can call this function without holding a lock, but be aware * You can call this function without holding a lock, but be aware
* that it may change before you use it. * that it may change before you use it.
*/ */
GIT_WARN_UNUSED_RESULT size_t git_sortedcache_entrycount( size_t git_sortedcache_entrycount(const git_sortedcache *sc);
const git_sortedcache *sc);
/* Lookup item by index - returns NULL if out of range */ /* Lookup item by index - returns NULL if out of range */
GIT_WARN_UNUSED_RESULT void *git_sortedcache_entry( void *git_sortedcache_entry(git_sortedcache *sc, size_t pos);
git_sortedcache *sc, size_t pos);
/* Lookup index of item by key - returns GIT_ENOTFOUND if not found */ /* Lookup index of item by key - returns GIT_ENOTFOUND if not found */
GIT_WARN_UNUSED_RESULT int git_sortedcache_lookup_index( int git_sortedcache_lookup_index(
size_t *out, git_sortedcache *sc, const char *key); size_t *out, git_sortedcache *sc, const char *key);
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment