-
-
Notifications
You must be signed in to change notification settings - Fork 282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove the hash_size param from H5Iregister_type() #5170
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
17ac0b6
Add an H5Iregister_type1 call
be3e06d
Fixes make_vers to work with v200
bfb5058
Extract common H5Iregister_type1/2 functionality
2b8c39b
Move line validation code to a new function
f0790e4
Added global definitions to avoid mysteries
7597e8e
Clean up make_vers
134d14e
Add a release note
c9d019a
Format source
4145a4c
Remove unused variable
aec8468
Fix for no deprecated symbols
1a28272
Remove extraneous variable
c183494
Remove blank line
558d5cb
Fix typo
e6c6113
Fix v111 comment
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | ||
* Copyright by The HDF Group. * | ||
* All rights reserved. * | ||
* * | ||
* This file is part of HDF5. The full HDF5 copyright notice, including * | ||
* terms governing use, modification, and redistribution, is contained in * | ||
* the LICENSE file, which can be found at the root of the source code * | ||
* distribution tree, or in https://www.hdfgroup.org/licenses. * | ||
* If you do not have access to either file, you may request a copy from * | ||
* help@hdfgroup.org. * | ||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | ||
|
||
/*------------------------------------------------------------------------- | ||
* | ||
* Created: H5Ideprec.c | ||
* | ||
* Purpose: Deprecated functions from the H5I interface. These | ||
* functions are here for compatibility purposes and may be | ||
* removed in the future. Applications should switch to the | ||
* newer APIs. | ||
* | ||
*------------------------------------------------------------------------- | ||
*/ | ||
|
||
/****************/ | ||
/* Module Setup */ | ||
/****************/ | ||
|
||
#include "H5Imodule.h" /* This source code file is part of the H5I module */ | ||
|
||
/***********/ | ||
/* Headers */ | ||
/***********/ | ||
#include "H5private.h" /* Generic Functions */ | ||
#include "H5Eprivate.h" /* Error handling */ | ||
#include "H5Ipkg.h" /* File access */ | ||
|
||
/****************/ | ||
/* Local Macros */ | ||
/****************/ | ||
|
||
/******************/ | ||
/* Local Typedefs */ | ||
/******************/ | ||
|
||
/********************/ | ||
/* Package Typedefs */ | ||
/********************/ | ||
|
||
/********************/ | ||
/* Local Prototypes */ | ||
/********************/ | ||
|
||
/*********************/ | ||
/* Package Variables */ | ||
/*********************/ | ||
|
||
/*****************************/ | ||
/* Library Private Variables */ | ||
/*****************************/ | ||
|
||
/*******************/ | ||
/* Local Variables */ | ||
/*******************/ | ||
|
||
#ifndef H5_NO_DEPRECATED_SYMBOLS | ||
/*------------------------------------------------------------------------- | ||
* Function: H5Iregister_type1 | ||
* | ||
* Purpose: Public interface to H5I_register_type. Creates a new type | ||
* of ID's to give out. A specific number (RESERVED) of type | ||
* entries may be reserved to enable "constant" values to be handed | ||
* out which are valid IDs in the type, but which do not map to any | ||
* data structures and are not allocated dynamically later. HASH_SIZE is | ||
* the minimum hash table size to use for the type. FREE_FUNC is | ||
* called with an object pointer when the object is removed from | ||
* the type. | ||
* | ||
* Return: Success: Type ID of the new type | ||
* Failure: H5I_BADID | ||
* | ||
*------------------------------------------------------------------------- | ||
*/ | ||
H5I_type_t | ||
H5Iregister_type1(size_t H5_ATTR_UNUSED hash_size, unsigned reserved, H5I_free_t free_func) | ||
{ | ||
H5I_type_t ret_value = H5I_BADID; | ||
|
||
FUNC_ENTER_API(H5I_BADID) | ||
|
||
if (H5I_BADID == (ret_value = H5I__register_type_common(reserved, free_func))) | ||
HGOTO_ERROR(H5E_ID, H5E_CANTINIT, H5I_BADID, "can't initialize ID class"); | ||
|
||
done: | ||
FUNC_LEAVE_API(ret_value) | ||
} /* end H5Iregister_type1() */ | ||
#endif /* H5_NO_DEPRECATED_SYMBOLS */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -156,6 +156,76 @@ H5I_term_package(void) | |
FUNC_LEAVE_NOAPI(in_use) | ||
} /* end H5I_term_package() */ | ||
|
||
/*------------------------------------------------------------------------- | ||
* Function: H5I__register_type_common | ||
* | ||
* Purpose: Common functionality for H5Iregister_type(1|2) | ||
* | ||
* Return: Success: Type ID of the new type | ||
* Failure: H5I_BADID | ||
*------------------------------------------------------------------------- | ||
*/ | ||
H5I_type_t | ||
H5I__register_type_common(unsigned reserved, H5I_free_t free_func) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like this function should return a pointer to the registered class rather than |
||
{ | ||
H5I_class_t *cls = NULL; /* New ID class */ | ||
H5I_type_t new_type = H5I_BADID; /* New ID type value */ | ||
H5I_type_t ret_value = H5I_BADID; /* Return value */ | ||
|
||
FUNC_ENTER_PACKAGE | ||
|
||
/* Generate a new H5I_type_t value */ | ||
|
||
/* Increment the number of types */ | ||
if (H5I_next_type_g < H5I_MAX_NUM_TYPES) { | ||
new_type = (H5I_type_t)H5I_next_type_g; | ||
H5I_next_type_g++; | ||
} | ||
else { | ||
bool done; /* Indicate that search was successful */ | ||
int i; | ||
|
||
/* Look for a free type to give out */ | ||
done = false; | ||
for (i = H5I_NTYPES; i < H5I_MAX_NUM_TYPES && done == false; i++) { | ||
if (NULL == H5I_type_info_array_g[i]) { | ||
/* Found a free type ID */ | ||
new_type = (H5I_type_t)i; | ||
done = true; | ||
} | ||
} | ||
|
||
/* Verify that we found a type to give out */ | ||
if (done == false) | ||
HGOTO_ERROR(H5E_ID, H5E_NOSPACE, H5I_BADID, "Maximum number of ID types exceeded"); | ||
} | ||
|
||
/* Allocate new ID class */ | ||
if (NULL == (cls = H5MM_calloc(sizeof(H5I_class_t)))) | ||
HGOTO_ERROR(H5E_ID, H5E_CANTALLOC, H5I_BADID, "ID class allocation failed"); | ||
|
||
/* Initialize class fields */ | ||
cls->type = new_type; | ||
cls->flags = H5I_CLASS_IS_APPLICATION; | ||
cls->reserved = reserved; | ||
cls->free_func = free_func; | ||
|
||
/* Register the new ID class */ | ||
if (H5I_register_type(cls) < 0) | ||
HGOTO_ERROR(H5E_ID, H5E_CANTINIT, H5I_BADID, "can't initialize ID class"); | ||
|
||
/* Set return value */ | ||
ret_value = new_type; | ||
|
||
done: | ||
/* Clean up on error */ | ||
if (ret_value == H5I_BADID) | ||
if (cls) | ||
cls = H5MM_xfree(cls); | ||
|
||
FUNC_LEAVE_NOAPI(ret_value) | ||
} /* end H5I__register_type_common() */ | ||
|
||
/*------------------------------------------------------------------------- | ||
* Function: H5I_register_type | ||
* | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reworked the whole script to just use an explicit list of supported versions. All that array index complexity was giving me a headache.