diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2023-07-27 20:43:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-27 20:43:30 (GMT) |
commit | 1e91d96fa02466ffe451319bdac1005f84dc7993 (patch) | |
tree | 4de04ef502c313dfd766497b20235188761146c0 /src/H5FDdirect.c | |
parent | 95e5349089b95dfb95f0f8ce2d6db1bc04ba6c82 (diff) | |
download | hdf5-1e91d96fa02466ffe451319bdac1005f84dc7993.zip hdf5-1e91d96fa02466ffe451319bdac1005f84dc7993.tar.gz hdf5-1e91d96fa02466ffe451319bdac1005f84dc7993.tar.bz2 |
Brings over most of the HD prefix removal (#3293)
Diffstat (limited to 'src/H5FDdirect.c')
-rw-r--r-- | src/H5FDdirect.c | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c index ccb8c85..a1449fe 100644 --- a/src/H5FDdirect.c +++ b/src/H5FDdirect.c @@ -349,9 +349,9 @@ H5FD__direct_populate_config(size_t boundary, size_t block_size, size_t cbuf_siz FUNC_ENTER_PACKAGE - HDassert(fa_out); + assert(fa_out); - HDmemset(fa_out, 0, sizeof(H5FD_direct_fapl_t)); + memset(fa_out, 0, sizeof(H5FD_direct_fapl_t)); if (boundary != 0) fa_out->mboundary = boundary; @@ -432,7 +432,7 @@ H5FD__direct_fapl_copy(const void *_old_fa) FUNC_ENTER_PACKAGE_NOERR - HDassert(new_fa); + assert(new_fa); /* Copy the general information */ H5MM_memcpy(new_fa, old_fa, sizeof(H5FD_direct_fapl_t)); @@ -476,7 +476,7 @@ H5FD__direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad FUNC_ENTER_PACKAGE /* Sanity check on file offsets */ - HDassert(sizeof(HDoff_t) >= sizeof(size_t)); + assert(sizeof(HDoff_t) >= sizeof(size_t)); /* Check arguments */ if (!name || !*name) @@ -549,10 +549,10 @@ H5FD__direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad * is to handle correctly the case that the file is in a different file system * than the one where the program is running. */ - /* NOTE: Use HDmalloc and HDfree here to ensure compatibility with + /* NOTE: Use malloc and free here to ensure compatibility with * HDposix_memalign. */ - buf1 = HDmalloc(sizeof(int)); + buf1 = malloc(sizeof(int)); if (HDposix_memalign(&buf2, file->fa.mboundary, file->fa.fbsize) != 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "HDposix_memalign failed") @@ -591,9 +591,9 @@ H5FD__direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad } if (buf1) - HDfree(buf1); + free(buf1); if (buf2) - HDfree(buf2); + free(buf2); /* Set return value */ ret_value = (H5FD_t *)file; @@ -685,9 +685,9 @@ H5FD__direct_cmp(const H5FD_t *_f1, const H5FD_t *_f2) * determine if the values are the same or not. The actual return value * shouldn't really matter... */ - if (HDmemcmp(&(f1->device), &(f2->device), sizeof(dev_t)) < 0) + if (memcmp(&(f1->device), &(f2->device), sizeof(dev_t)) < 0) HGOTO_DONE(-1) - if (HDmemcmp(&(f1->device), &(f2->device), sizeof(dev_t)) > 0) + if (memcmp(&(f1->device), &(f2->device), sizeof(dev_t)) > 0) HGOTO_DONE(1) #endif /* H5_DEV_T_IS_SCALAR */ @@ -882,8 +882,8 @@ H5FD__direct_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_U FUNC_ENTER_PACKAGE - HDassert(file && file->pub.cls); - HDassert(buf); + assert(file && file->pub.cls); + assert(buf); /* Check for overflow conditions */ if (HADDR_UNDEF == addr) @@ -921,11 +921,11 @@ H5FD__direct_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_U HSYS_GOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed") if (0 == nbytes) { /* end of file but not end of format address space */ - HDmemset(buf, 0, size); + memset(buf, 0, size); break; } - HDassert(nbytes >= 0); - HDassert((size_t)nbytes <= size); + assert(nbytes >= 0); + assert((size_t)nbytes <= size); H5_CHECK_OVERFLOW(nbytes, ssize_t, size_t); size -= (size_t)nbytes; H5_CHECK_OVERFLOW(nbytes, ssize_t, haddr_t); @@ -943,12 +943,12 @@ H5FD__direct_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_U alloc_size = ((copy_offset + size - 1) / _fbsize + 1) * _fbsize; if (alloc_size > _cbsize) alloc_size = _cbsize; - HDassert(!(alloc_size % _fbsize)); + assert(!(alloc_size % _fbsize)); if (HDposix_memalign(©_buf, _boundary, alloc_size) != 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "HDposix_memalign failed") /* look for the aligned position for reading the data */ - HDassert(!(((addr / _fbsize) * _fbsize) % _fbsize)); + assert(!(((addr / _fbsize) * _fbsize) % _fbsize)); if (HDlseek(file->fd, (HDoff_t)((addr / _fbsize) * _fbsize), SEEK_SET) < 0) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") @@ -963,7 +963,7 @@ H5FD__direct_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_U * system calls and partial results like sec2 driver does because the * data may no longer be aligned. It's especially true when the data in * file is smaller than ALLOC_SIZE. */ - HDmemset(copy_buf, 0, alloc_size); + memset(copy_buf, 0, alloc_size); /* Calculate how much data we have to read in this iteration * (including unused parts of blocks) */ @@ -972,7 +972,7 @@ H5FD__direct_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_U else read_size = alloc_size; - HDassert(!(read_size % _fbsize)); + assert(!(read_size % _fbsize)); do { nbytes = HDread(file->fd, copy_buf, read_size); } while (-1 == nbytes && EINTR == errno); @@ -1003,8 +1003,8 @@ H5FD__direct_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_U addr = (haddr_t)(((addr + size - 1) / _fbsize + 1) * _fbsize); if (copy_buf) { - /* Free with HDfree since it came from posix_memalign */ - HDfree(copy_buf); + /* Free with free since it came from posix_memalign */ + free(copy_buf); copy_buf = NULL; } /* end if */ } @@ -1015,9 +1015,9 @@ H5FD__direct_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_U done: if (ret_value < 0) { - /* Free with HDfree since it came from posix_memalign */ + /* Free with free since it came from posix_memalign */ if (copy_buf) - HDfree(copy_buf); + free(copy_buf); /* Reset last file I/O information */ file->pos = HADDR_UNDEF; @@ -1065,8 +1065,8 @@ H5FD__direct_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_ FUNC_ENTER_PACKAGE - HDassert(file && file->pub.cls); - HDassert(buf); + assert(file && file->pub.cls); + assert(buf); /* Check for overflow conditions */ if (HADDR_UNDEF == addr) @@ -1101,8 +1101,8 @@ H5FD__direct_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_ } while (-1 == nbytes && EINTR == errno); if (-1 == nbytes) /* error */ HSYS_GOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") - HDassert(nbytes > 0); - HDassert((size_t)nbytes <= size); + assert(nbytes > 0); + assert((size_t)nbytes <= size); H5_CHECK_OVERFLOW(nbytes, ssize_t, size_t); size -= (size_t)nbytes; H5_CHECK_OVERFLOW(nbytes, ssize_t, haddr_t); @@ -1123,7 +1123,7 @@ H5FD__direct_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_ alloc_size = ((copy_offset + size - 1) / _fbsize + 1) * _fbsize; if (alloc_size > _cbsize) alloc_size = _cbsize; - HDassert(!(alloc_size % _fbsize)); + assert(!(alloc_size % _fbsize)); if (HDposix_memalign(©_buf, _boundary, alloc_size) != 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "HDposix_memalign failed") @@ -1150,11 +1150,11 @@ H5FD__direct_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_ * both ends are misaligned, otherwise only read the block on the * misaligned end. */ - HDmemset(copy_buf, 0, _fbsize); + memset(copy_buf, 0, _fbsize); if (copy_offset > 0) { if ((write_addr + write_size) > (addr + size)) { - HDassert((write_addr + write_size) - (addr + size) < _fbsize); + assert((write_addr + write_size) - (addr + size) < _fbsize); read_size = write_size; p1 = copy_buf; } /* end if */ @@ -1164,12 +1164,12 @@ H5FD__direct_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_ } /* end else */ } /* end if */ else if ((write_addr + write_size) > (addr + size)) { - HDassert((write_addr + write_size) - (addr + size) < _fbsize); + assert((write_addr + write_size) - (addr + size) < _fbsize); read_size = _fbsize; p1 = (unsigned char *)copy_buf + write_size - _fbsize; /* Seek to the last block, for reading */ - HDassert(!((write_addr + write_size - _fbsize) % _fbsize)); + assert(!((write_addr + write_size - _fbsize) % _fbsize)); if (HDlseek(file->fd, (HDoff_t)(write_addr + write_size - _fbsize), SEEK_SET) < 0) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") } /* end if */ @@ -1177,7 +1177,7 @@ H5FD__direct_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_ p1 = NULL; if (p1) { - HDassert(!(read_size % _fbsize)); + assert(!(read_size % _fbsize)); do { nbytes = HDread(file->fd, p1, read_size); } while (-1 == nbytes && EINTR == errno); @@ -1205,7 +1205,7 @@ H5FD__direct_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_ } /* end else */ /*look for the aligned position for writing the data*/ - HDassert(!(write_addr % _fbsize)); + assert(!(write_addr % _fbsize)); if (HDlseek(file->fd, (HDoff_t)write_addr, SEEK_SET) < 0) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") @@ -1213,7 +1213,7 @@ H5FD__direct_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_ * Write the data. It doesn't truncate the extra data introduced by * alignment because that step is done in H5FD_direct_flush. */ - HDassert(!(write_size % _fbsize)); + assert(!(write_size % _fbsize)); do { nbytes = HDwrite(file->fd, copy_buf, write_size); } while (-1 == nbytes && EINTR == errno); @@ -1230,8 +1230,8 @@ H5FD__direct_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_ buf = (const char *)buf + size; if (copy_buf) { - /* Free with HDfree since it came from posix_memalign */ - HDfree(copy_buf); + /* Free with free since it came from posix_memalign */ + free(copy_buf); copy_buf = NULL; } /* end if */ } @@ -1244,9 +1244,9 @@ H5FD__direct_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_ done: if (ret_value < 0) { - /* Free with HDfree since it came from posix_memalign */ + /* Free with free since it came from posix_memalign */ if (copy_buf) - HDfree(copy_buf); + free(copy_buf); /* Reset last file I/O information */ file->pos = HADDR_UNDEF; @@ -1279,7 +1279,7 @@ H5FD__direct_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_AT FUNC_ENTER_PACKAGE - HDassert(file); + assert(file); /* Extend the file to make sure it's large enough */ if (file->eoa != file->eof) { @@ -1343,7 +1343,7 @@ H5FD__direct_lock(H5FD_t *_file, hbool_t rw) FUNC_ENTER_PACKAGE - HDassert(file); + assert(file); /* Set exclusive or shared lock based on rw status */ lock_flags = rw ? LOCK_EX : LOCK_SH; @@ -1383,7 +1383,7 @@ H5FD__direct_unlock(H5FD_t *_file) FUNC_ENTER_PACKAGE - HDassert(file); + assert(file); if (HDflock(file->fd, LOCK_UN) < 0) { if (file->ignore_disabled_file_locks && ENOSYS == errno) { @@ -1416,7 +1416,7 @@ H5FD__direct_delete(const char *filename, hid_t H5_ATTR_UNUSED fapl_id) FUNC_ENTER_PACKAGE - HDassert(filename); + assert(filename); if (HDremove(filename) < 0) HSYS_GOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "unable to delete file") |