]> git.sur5r.net Git - cc65/blobdiff - src/cc65/stdfunc.c
Rewrote literal handling. Literals are now saved together with other function
[cc65] / src / cc65 / stdfunc.c
index 4f48c4fc4d3c5626397f23790c1f3ced7227c318..0c3e2779da38e0897f8e19a3453a561b6f63309a 100644 (file)
@@ -933,7 +933,8 @@ static void StdFunc_strlen (FuncDesc* F attribute ((unused)), ExprDesc* Expr)
 
     /* Do type conversion */
     TypeConversion (&Arg, ArgType);
-
+      
+#if 0
     /* If the expression is a literal, and if string literals are read
      * only, we can calculate the length of the string and remove it
      * from the literal pool. Otherwise we have to calculate the length
@@ -942,14 +943,15 @@ static void StdFunc_strlen (FuncDesc* F attribute ((unused)), ExprDesc* Expr)
     if (ED_IsLocLiteral (&Arg) && IS_Get (&WritableStrings) == 0) {
 
         /* Constant string literal */
-        ED_MakeConstAbs (Expr, strlen (GetLiteral (Arg.IVal)), type_size_t);
-        ResetLiteralPoolOffs (Arg.IVal);
+        ED_MakeConstAbs (Expr, GetLiteralSize (GetLiteral (Arg.IVal)), type_size_t);
 
     /* We will inline strlen for arrays with constant addresses, if either the
      * inlining was forced on the command line, or the array is smaller than
      * 256, so the inlining is considered safe.
      */
-    } else if (ED_IsLocConst (&Arg) && IsArray &&
+    } else
+#endif
+    if (ED_IsLocConst (&Arg) && IsArray &&
                (IS_Get (&InlineStdFuncs) || IsByteIndex)) {
 
         /* Generate the strlen code */