1919 * CallstackLibrary, see the file LICENSE. If not, see <https://www.gnu.org/licenses/>.
2020 */
2121
22+ #include "cache.h"
23+
2224#include <stdbool.h>
2325#include <string.h>
2426
2527#include "archive.h"
26- #include "cache.h"
27-
2828#include "../vector_string.h"
2929
3030/**
@@ -42,27 +42,28 @@ static struct macho_cache {
4242/**
4343 * @brief Returns whether the given file name is inside an archive.
4444 *
45- * If ` NULL` is passed, ` false` is returned.
45+ * If @c NULL is passed, @c false is returned.
4646 *
4747 * @param fileName the file name to be checked
4848 * @return whether the file name is inside an archive
4949 */
5050static inline bool macho_cache_isInArchive (const char * fileName ) {
5151 if (fileName == NULL ) return false;
52-
53- char * lp = strrchr (fileName , '(' );
54- char * rp = strrchr (fileName , ')' );
52+
53+ const char * lp = strrchr (fileName , '(' );
54+ const char * rp = strrchr (fileName , ')' );
5555
5656 return lp != NULL && rp != NULL && lp < rp ;
5757}
5858
5959/**
6060 * @brief Returns the archive name of the given file name.
6161 *
62- * The returned string is allocated and needs to be `free`d .
62+ * The returned string is allocated and needs to be freed .
6363 *
6464 * @param fileName the full file name
65- * @return the archive name or `NULL` if the allocation failed or the given file name is not inside an archive
65+ * @return the archive name or @c NULL if the allocation failed or the given
66+ * file name is not inside an archive
6667 */
6768static inline char * macho_cache_getArchiveName (const char * fileName ) {
6869 if (fileName == NULL ) return NULL ;
@@ -80,7 +81,8 @@ static inline char* macho_cache_getArchiveName(const char* fileName) {
8081}
8182
8283/**
83- * The callback function for the archive parser adds the given object file object to the cache.
84+ * The callback function for the archive parser adds the given object file
85+ * object to the cache.
8486 *
8587 * @param file the object file object to be added
8688 */
@@ -92,7 +94,7 @@ static inline void macho_cache_archiveCallback(struct objectFile* file) {
9294/**
9395 * @brief Loads the archive of the given file name.
9496 *
95- * When ` NULL` is passed, ` false` is returned.
97+ * When @c NULL is passed, @c false is returned.
9698 *
9799 * @param archiveName the file name of the archive to be loaded
98100 * @return whether the archive was loaded successfully
@@ -118,7 +120,7 @@ static inline bool macho_cache_archiveLoaded(const char* archiveName) {
118120 return false;
119121}
120122
121- struct objectFile * macho_cache_findOrAdd (const char * fileName , uint64_t lastModified ) {
123+ struct objectFile * macho_cache_findOrAdd (const char * fileName , const uint64_t lastModified ) {
122124 struct objectFile * it ;
123125 for (it = cache .objectFiles ; it != NULL && strcmp (it -> name , fileName ) != 0 ; it = it -> next );
124126
@@ -138,7 +140,7 @@ struct objectFile* macho_cache_findOrAdd(const char* fileName, uint64_t lastModi
138140 return NULL ;
139141 }
140142 it -> name = strdup (fileName );
141- it -> lastModified = lastModified ;
143+ it -> lastModified = ( time_t ) lastModified ;
142144 it -> next = cache .objectFiles ;
143145 cache .objectFiles = it ;
144146 }
0 commit comments