The only use of this function stores the return value in a long, so lets just
return a long, squashing two compiler warnings.
#include <ast/ast.h>
#include <gvpr/compile.h>
#include <ast/sfstr.h>
+#include <limits.h>
#include <stddef.h>
#include <string.h>
#include <stdio.h>
/* rindexOf:
* Return index of rightmost string s2 in string s1, or -1
*/
-int rindexOf(char *s1, char *s2)
+long rindexOf(char *s1, char *s2)
{
char c1 = *s2;
char *p;
size_t len1 = strlen(s1);
size_t len2 = strlen(s2);
- if (c1 == '\0')
- return (len1);
+ if (c1 == '\0') {
+ assert(len1 <= LONG_MAX);
+ return (long)len1;
+ }
if (len2 > len1)
return -1;
p = s1 + (len1 - len2);
extern Agobj_t *copy(Agraph_t * g, Agobj_t * obj);
extern int copyAttr(Agobj_t * obj, Agobj_t * obj1);
extern int indexOf(char *s1, char *s2);
- extern int rindexOf(char *s1, char *s2);
+ extern long rindexOf(char *s1, char *s2);
extern int match(char *str, char *pat);
extern int lockGraph(Agraph_t * g, int);
extern Agraph_t *compOf(Agraph_t * g, Agnode_t * n);