[Bug translator/10300] New: Provide more macros for embedded-C functions
jistone at redhat dot com
sourceware-bugzilla@sourceware.org
Fri Jun 19 00:39:00 GMT 2009
It might be nice to have a convenience macro in embedded-C functions which sets
the return value and exits the function. This would be specialized to the
return type of the function, basically:
long:
#define RETURN(val) THIS->__retvalue = (val), goto out
string:
#define RETURN(val) strlcpy(THIS->__retvalue, (val), MAXSTRINGLEN), goto out
no return value:
#define RETURN() goto out
Similarly, for signaling errors/warnings we may want:
#define ERROR(...) \
snprintf(CONTEXT->error_buffer, MAXSTRINGLEN, __VA_ARGS__), \
CONTEXT->last_error = CONTEXT->error_buffer, goto out
#define WARN(...) \
snprintf(CONTEXT->error_buffer, MAXSTRINGLEN, __VA_ARGS__), \
_stp_warn(CONTEXT->error_buffer)
Thoughts?
--
Summary: Provide more macros for embedded-C functions
Product: systemtap
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: translator
AssignedTo: systemtap at sources dot redhat dot com
ReportedBy: jistone at redhat dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=10300
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the Systemtap
mailing list