Changeset f72ae3b in mainline
- Timestamp:
- 2012-08-16T23:36:59Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f039dba
- Parents:
- 330a59f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/io/log.c
r330a59f rf72ae3b 195 195 } 196 196 197 /** Create logging context. 198 * 199 * This function always returns a valid context. 197 /** Create a new (sub-) log. 198 * 199 * This function always returns a valid log_t. In case of errors, 200 * @c parent is returned and errors are silently ignored. 201 * 202 * @param name Log name under which message will be reported (appended to parents name). 203 * @param parent Parent log. 204 * @return Opaque identifier of the newly created log. 200 205 */ 201 206 log_t log_create(const char *name, log_t parent) … … 204 209 if (info == NULL) 205 210 return LOG_DEFAULT; 211 info->name = NULL; 206 212 207 213 if (parent == LOG_DEFAULT) { 208 214 info->name = str_dup(name); 209 if (info->name == NULL) { 210 free(info); 211 return LOG_DEFAULT; 212 } 215 if (info->name == NULL) 216 goto error; 213 217 info->top_log_id = default_top_log_id; 214 218 } else { … … 216 220 int rc = asprintf(&info->name, "%s/%s", 217 221 parent_info->name, name); 218 if (rc < 0) { 219 free(info); 220 return LOG_DEFAULT; 221 } 222 if (rc < 0) 223 goto error; 222 224 info->top_log_id = parent_info->top_log_id; 223 225 } … … 245 247 free(info->name); 246 248 free(info); 247 return LOG_DEFAULT;249 return parent; 248 250 } 249 251
Note:
See TracChangeset
for help on using the changeset viewer.