Skip to content

Commit 7481867

Browse files
authored
Merge pull request #1798 from CEED/jeremy/xskd-tidy
tidy - minor fixes
2 parents 2f50400 + 7d0543c commit 7481867

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,7 @@ vermin :
957957
CLANG_TIDY ?= clang-tidy
958958

959959
%.c.tidy : %.c
960-
$(CLANG_TIDY) $(TIDY_OPTS) $^ -- $(CPPFLAGS) --std=c99 -I$(CUDA_DIR)/include -I$(ROCM_DIR)/include -DCEED_JIT_SOURCE_ROOT_DEFAULT="\"$(abspath ./include)/\""
960+
$(CLANG_TIDY) $(TIDY_OPTS) $^ -- $(CPPFLAGS) --std=c99 -I$(CUDA_DIR)/include -I$(ROCM_DIR)/include -DCEED_JIT_SOURCE_ROOT_DEFAULT="\"$(abspath ./include)/\"" -DCEED_GIT_VERSION="\"$(GIT_DESCRIBE)\"" -DCEED_BUILD_CONFIGURATION="\"// Build Configuration:$(foreach v,$(CONFIG_VARS),\n$(v) = $($(v)))\""
961961

962962
%.cpp.tidy : %.cpp
963963
$(CLANG_TIDY) $(TIDY_OPTS) $^ -- $(CPPFLAGS) --std=c++11 -I$(CUDA_DIR)/include -I$(OCCA_DIR)/include -I$(ROCM_DIR)/include

interface/ceed-config.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,39 +14,39 @@ const char *CeedBuildConfiguration = CEED_BUILD_CONFIGURATION;
1414
/// @{
1515

1616
/**
17-
@brief Get output of `git describe --dirty` from build time
17+
@brief Get output of `git describe --dirty` from build time.
1818
19-
While @ref CeedGetVersion() uniqely identifies the source code for release
19+
While @ref CeedGetVersion() uniquely identifies the source code for release
2020
builds, it does not identify builds from other commits.
2121
2222
@param[out] git_version A static string containing the Git commit description.
2323
2424
If `git describe --always --dirty` fails, the string `"unknown"` will be provided.
2525
This could occur if Git is not installed or if libCEED is not being built from a repository, for example.`
2626
27-
@return An error code: 0 - success, otherwise - failure
28-
2927
@ref Developer
3028
3129
@sa CeedGetVersion() CeedGetBuildConfiguration()
30+
31+
@return An error code: 0 - success, otherwise - failure
3232
*/
3333
int CeedGetGitVersion(const char **git_version) {
3434
*git_version = CeedGitVersion;
3535
return CEED_ERROR_SUCCESS;
3636
}
3737

3838
/**
39-
@brief Get build variables as a multi-line string
39+
@brief Get build variables as a multi-line string.
4040
4141
Each line of the string has the format `VARNAME = value`.
4242
4343
@param[out] build_config A static string containing build variables
4444
45-
@return An error code: 0 - success, otherwise - failure
46-
4745
@ref Developer
4846
4947
@sa CeedGetVersion() CeedGetGitVersion()
48+
49+
@return An error code: 0 - success, otherwise - failure
5050
*/
5151
int CeedGetBuildConfiguration(const char **build_config) {
5252
*build_config = CeedBuildConfiguration;

interface/ceed-jit-tools.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,15 @@ int CeedLoadSourceToInitializedBuffer(Ceed ceed, const char *source_file_path, C
137137
// -- Compute size of source
138138
fseek(source_file, 0L, SEEK_END);
139139
file_size = ftell(source_file);
140-
rewind(source_file);
140+
fseek(source_file, 0L, SEEK_SET);
141141
// -- Allocate memory for entire source file
142-
CeedCall(CeedCalloc(file_size + 1, &temp_buffer));
142+
{
143+
const int ierr = CeedCalloc(file_size + 1, &temp_buffer);
144+
145+
// Close stream before error handling, if necessary
146+
if (ierr != CEED_ERROR_SUCCESS) fclose(source_file);
147+
CeedCall(ierr);
148+
}
143149
// -- Copy the file into the buffer
144150
if (1 != fread(temp_buffer, file_size, 1, source_file)) {
145151
// LCOV_EXCL_START

0 commit comments

Comments
 (0)