This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: [PATCH 1/2] [TAKE 3] Add str_replace() To Tapsets
- From: fche at redhat dot com (Frank Ch. Eigler)
- To: Varun Chandramohan <varunc at linux dot vnet dot ibm dot com>
- Cc: systemtap at sourceware dot org, Josh Stone <jistone at redhat dot com>
- Date: Thu, 18 Jun 2009 10:50:13 -0400
- Subject: Re: [PATCH 1/2] [TAKE 3] Add str_replace() To Tapsets
- References: <20090618152905.e10b4ce1.varunc@linux.vnet.ibm.com>
Varun Chandramohan <varunc@linux.vnet.ibm.com> writes:
> [...]
> /*
> + * str_replace - Takes a parent string, uses the second string which is a
> + * substring to parent string and replaces that with the
> + * third string of same lenght as second and returns the
> + * new converted parent string.
> + * [...]
> + */
Would it be possible to use the extractable @sfunc style of
documentation markup, so that a man page is automatically generated
for str_replace()?
> +function str_replace:string (prnt_str:string, srch_str:string, rplc_str:string)
> +%{
> +[...]
> + if(strlen_srch_str == 0) {
> + CONTEXT->last_error = "Invalid Search String";
> + return;
> + }
FWIW, I wouldn't bother with signalling an error for this. Just
define a fallback policy, such as returning the original prnt_str,
or perhaps an empty one.
- FChE