This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/2] [TAKE 3] Add str_replace() To Tapsets


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]