// Standard string functions tapset.
-// Copyright (C) 2009 Red Hat, Inc.
+// Copyright (C) 2009-2014 Red Hat, Inc.
//
// This file is part of systemtap, and is free software. You can
// redistribute it and/or modify it under the terms of the GNU General
* can be zero up to MAXSTRINGLEN.
*/
function strlen:long(s:string) %{ /* pure */ /* unprivileged */
- STAP_RETVALUE = strlen(STAP_ARG_s);
+ STAP_RETURN(strlen(STAP_ARG_s));
%}
/**
*/
function stringat:long(str:string, pos:long) %{ /* pure */ /* unprivileged */
if (STAP_ARG_pos >= 0 && STAP_ARG_pos < strlen(STAP_ARG_str))
- STAP_RETVALUE = STAP_ARG_str[STAP_ARG_pos];
+ STAP_RETURN(STAP_ARG_str[STAP_ARG_pos]);
else {
STAP_RETVALUE = 0;
#if STAP_COMPAT_VERSION >= STAP_VERSION(2,3) // PR15044
- CONTEXT->last_error = "Position out of bounds";
+ STAP_ERROR("Position out of bounds");
#endif
}
%}
* otherwise zero.
*/
function isinstr:long(s1:string,s2:string) %{ /* pure */ /* unprivileged */
- if (strstr(STAP_ARG_s1,STAP_ARG_s2) != NULL)
- STAP_RETVALUE = 1;
- else
- STAP_RETVALUE = 0;
+ STAP_RETURN (strstr(STAP_ARG_s1,STAP_ARG_s2) != NULL);
%}
/**
STAP_RETVALUE[0] = '\0';
if(strlen_srch_str == 0) {
- strlcat(STAP_RETVALUE, ptr_base, MAXSTRINGLEN);
- return;
+ STAP_RETURN (ptr_base);
}
while((ptr = strstr(ptr, STAP_ARG_srch_str)) != NULL) {
ptr_base = ptr;
}
- strlcat(STAP_RETVALUE, ptr_base, MAXSTRINGLEN);
- return;
+ STAP_RETURN (ptr_base);
%}
/**
*/
function strtol:long(str:string, base:long)
%{ /* pure */ /* unprivileged */
- STAP_RETVALUE = simple_strtol(STAP_ARG_str, NULL, STAP_ARG_base);
+ STAP_RETURN(simple_strtol(STAP_ARG_str, NULL, STAP_ARG_base));
%}
/**
*/
function isdigit:long(str:string)
%{ /* pure */ /* unprivileged */
- STAP_RETVALUE = isdigit(STAP_ARG_str[0]);
+ STAP_RETURN(isdigit(STAP_ARG_str[0]));
%}