PengZheng commented on code in PR #518: URL: https://github.com/apache/celix/pull/518#discussion_r1163768569
########## libs/rcm/src/celix_rcm_err_private.h: ########## @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#ifndef CELIX_CELIX_RCM_ERR_PRIVATE_H +#define CELIX_CELIX_RCM_ERR_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Push an formatted error message to the thread specific storage rcm errors. + */ +void celix_rcmErr_pushf(const char* format, ...) __attribute__((format(printf, 1, 2))); Review Comment: This should also be public? ########## libs/rcm/include/celix_rcm_err.h: ########## @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#ifndef CELIX_CELIX_RCM_ERR_H +#define CELIX_CELIX_RCM_ERR_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @file celix_rcm_err.h + * @brief The rcm error handling functions. + * @thread_safety Thread safe. + */ + +/** + * @brief Returns the last error message from the current thread. + * The error message must be freed by the caller. + * @returnval NULL if no error message is available. + */ +char* celix_rcmErr_popLastError(); Review Comment: Should Err be put in a separate library or in utils? I don't expect it to be a rcm thing. ########## libs/error_injector/asprintf/src/asprintf_ei.cc: ########## @@ -37,4 +37,13 @@ int __wrap_asprintf(char** buf, const char* format, ...) { return rc; } +int __real_vasprintf(char **buf, const char *format, va_list args); +CELIX_EI_DEFINE(vasprintf, int) +int __wrap_vasprintf(char **buf, const char *format, va_list args) { + errno = ENOMEM; + CELIX_EI_IMPL(vasprintf); + errno = 0; + return __real_vasprintf(buf, format, args); Review Comment: Now that we hijacked `vasprintf`, `__wrap_asprintf` should be implemented by `__real_vasprintf` instead of `vasprintf`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@celix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org