This is an automated email from the ASF dual-hosted git repository.
pengzheng pushed a commit to branch feature/527-manifest-improvement
in repository https://gitbox.apache.org/repos/asf/celix.git
The following commit(s) were added to
refs/heads/feature/527-manifest-improvement by this push:
new 779e73a4 API documentation revised and local variables renamed based
on code review comments.
779e73a4 is described below
commit 779e73a468d82964173d2bc2dda37a845aae988c
Author: PengZheng <[email protected]>
AuthorDate: Fri Aug 18 20:49:40 2023 +0800
API documentation revised and local variables renamed based on code review
comments.
---
libs/framework/src/manifest.c | 16 ++++++++--------
libs/utils/include/celix_err.h | 2 +-
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/libs/framework/src/manifest.c b/libs/framework/src/manifest.c
index 2a42378c..4f0884e9 100644
--- a/libs/framework/src/manifest.c
+++ b/libs/framework/src/manifest.c
@@ -161,12 +161,12 @@ celix_status_t manifest_read(manifest_pt manifest, const
char *filename) {
}
celix_status_t manifest_readFromStream(manifest_pt manifest, FILE* stream) {
- char lbuf[512];
- char *bytes = lbuf;
+ char stackBuf[512];
+ char *bytes = stackBuf;
// get file size
- if(fseek(stream, 0L, SEEK_END) == -1) {
- return CELIX_ERROR_MAKE(CELIX_FACILITY_CERRNO,errno);
+ if (fseek(stream, 0L, SEEK_END) == -1) {
+ return CELIX_ERROR_MAKE(CELIX_FACILITY_CERRNO, errno);
}
long int size = ftell(stream);
if (size < 0) {
@@ -177,10 +177,10 @@ celix_status_t manifest_readFromStream(manifest_pt
manifest, FILE* stream) {
}
rewind(stream);
- celix_autofree char* largeBuf = NULL;
- if (size+1 > sizeof(lbuf)) {
- largeBuf = bytes = malloc(size+1);
- if (largeBuf == NULL) {
+ celix_autofree char* heapBuf = NULL;
+ if (size+1 > sizeof(stackBuf)) {
+ heapBuf = bytes = malloc(size+1);
+ if (heapBuf == NULL) {
celix_err_pushf("Manifest error: failed to allocate %ld bytes",
size);
return CELIX_ENOMEM;
}
diff --git a/libs/utils/include/celix_err.h b/libs/utils/include/celix_err.h
index 854b8a51..95ce0d61 100644
--- a/libs/utils/include/celix_err.h
+++ b/libs/utils/include/celix_err.h
@@ -85,7 +85,7 @@ CELIX_UTILS_EXPORT void celix_err_printErrors(FILE* stream,
const char* prefix,
/**
* @brief Dump error messages from the current thread to the provided buffer.
- * @param[in] buf The buffer to dump the error messages to.
+ * @param[in,out] buf The buffer to dump the error messages to.
* @param[in] size The size of the buffer.
* @param[in] prefix The prefix to print before each error message. If NULL no
prefix is printed.
* @param[in] postfix The postfix to print after each error message. If NULL,
a '\n' postfix is printed.