PengZheng commented on code in PR #518:
URL: https://github.com/apache/celix/pull/518#discussion_r1165586719


##########
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:
   > I think the API still needs some discussion
   
   Yes, I suggest we spend some time on OpenSSL ERR's design and usage pattern.
   For example, I don't have to cleanup ERR manually.
   But with current design, error will accumulate in the queue.
   
   Another thing concerning me is dynamic allocation. 
   ERR also supports `celix_rcmErr_pushf` and uses dynamic memory allocation in 
that case. 
   But I remember in lots of case constant error string is used, and thus 
without malloc. But I might be wrong.



-- 
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

Reply via email to