Skip to content

Commit f12dbeb

Browse files
author
Phil Carns
authored
Merge pull request #1035 from darshan-hpc/dev-clang20-cleanups
clang20 cleanups
2 parents 76ce734 + 9d969d7 commit f12dbeb

File tree

5 files changed

+19
-10
lines changed

5 files changed

+19
-10
lines changed

darshan-runtime/lib/darshan-stdio.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,10 @@ extern int __real_fileno(FILE *stream);
215215
STDIO_UNLOCK(); \
216216
} while(0)
217217

218+
/* 'darshan_clean_file_path' normally returns a newly allocated string, but it
219+
* might return NULL if __path is a special case (e.g. '<STDIN>'). If we see
220+
* that case, we'll make a copy of __path. Now we don't need any special
221+
* checks and _newpath can always bedeallocated in cleanup */
218222
#define STDIO_RECORD_OPEN(__ret, __path, __tm1, __tm2) do { \
219223
darshan_record_id __rec_id; \
220224
struct stdio_file_record_ref *__rec_ref; \
@@ -223,16 +227,16 @@ extern int __real_fileno(FILE *stream);
223227
(void)__darshan_disabled; \
224228
if(!__ret || !__path) break; \
225229
__newpath = darshan_clean_file_path(__path); \
226-
if(!__newpath) __newpath = (char*)__path; \
230+
if(!__newpath) __newpath = strdup((__path)); \
227231
__rec_id = darshan_core_gen_record_id(__newpath); \
228232
__rec_ref = darshan_lookup_record_ref(stdio_runtime->rec_id_hash, &__rec_id, sizeof(darshan_record_id)); \
229233
if(!__rec_ref) __rec_ref = stdio_track_new_file_record(__rec_id, __newpath); \
230234
if(!__rec_ref) { \
231-
if(__newpath != (char*)__path) free(__newpath); \
235+
free(__newpath); \
232236
break; \
233237
} \
234238
_STDIO_RECORD_OPEN(__ret, __rec_ref, __tm1, __tm2, 1, -1); \
235-
if(__newpath != (char*)__path) free(__newpath); \
239+
free(__newpath); \
236240
/* LDMS to publish realtime open tracing information to daemon*/ \
237241
if(dC.ldms_lib)\
238242
if(dC.stdio_enable_ldms)\

darshan-runtime/lib/lookup8.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,12 @@ Use for hash table lookup, or anything where one collision in 2^^64
8080
is acceptable. Do NOT use for cryptographic purposes.
8181
--------------------------------------------------------------------
8282
*/
83-
84-
ub8 darshan_hash( k, length, level)
83+
#if 0
8584
const register ub1 *k; /* the key */
8685
register ub8 length; /* the length of the key */
8786
register ub8 level; /* the previous hash, or an arbitrary value */
87+
#endif
88+
ub8 darshan_hash( const register ub1 *k, register ub8 length, register ub8 level)
8889
{
8990
register ub8 a,b,c,len;
9091

@@ -150,10 +151,12 @@ register ub8 level; /* the previous hash, or an arbitrary value */
150151
-- that the length be the number of ub8's in the key
151152
--------------------------------------------------------------------
152153
*/
153-
ub8 hash2( k, length, level)
154+
#if 0
154155
register ub8 *k; /* the key */
155156
register ub8 length; /* the length of the key */
156157
register ub8 level; /* the previous hash, or an arbitrary value */
158+
#endif
159+
ub8 hash2( register ub8 *k, register ub8 length, register ub8 level)
157160
{
158161
register ub8 a,b,c,len;
159162

@@ -195,10 +198,12 @@ register ub8 level; /* the previous hash, or an arbitrary value */
195198
--------------------------------------------------------------------
196199
*/
197200

198-
ub8 hash3( k, length, level)
201+
#if 0
199202
register ub1 *k; /* the key */
200203
register ub8 length; /* the length of the key */
201204
register ub8 level; /* the previous hash, or an arbitrary value */
205+
#endif
206+
ub8 hash3( register ub1 *k, register ub8 length, register ub8 level)
202207
{
203208
register ub8 a,b,c,len;
204209

darshan-util/darshan-hdf5-logutils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ static int darshan_log_get_hdf5_dataset(darshan_fd fd, void** hdf5_buf_p)
219219
struct darshan_hdf5_dataset *ds = *((struct darshan_hdf5_dataset **)hdf5_buf_p);
220220
int rec_len;
221221
int i;
222-
int ret;
222+
int ret=0;
223223

224224
if(fd->mod_map[DARSHAN_H5D_MOD].len == 0)
225225
return(0);

darshan-util/darshan-pnetcdf-logutils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ static int darshan_log_get_pnetcdf_var(darshan_fd fd, void** pnetcdf_buf_p)
253253
struct darshan_pnetcdf_var *var = *((struct darshan_pnetcdf_var **)pnetcdf_buf_p);
254254
int rec_len;
255255
int i;
256-
int ret;
256+
int ret=0;
257257

258258
if(fd->mod_map[DARSHAN_PNETCDF_VAR_MOD].len == 0)
259259
return(0);

darshan-util/darshan-stdio-logutils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ static int darshan_log_get_stdio_record(darshan_fd fd, void** stdio_buf_p)
142142
struct darshan_stdio_file *file = *((struct darshan_stdio_file **)stdio_buf_p);
143143
int rec_len;
144144
int i;
145-
int ret;
145+
int ret=0;
146146

147147
if(fd->mod_map[DARSHAN_STDIO_MOD].len == 0)
148148
return(0);

0 commit comments

Comments
 (0)