VirtualBox

Changeset 2698 in kBuild for trunk/src/kmk


Ignore:
Timestamp:
Sep 16, 2013 10:47:27 PM (11 years ago)
Author:
bird
Message:

kmk: Extended the substr function to allow refering length from the end of the string by using negative numbers (just like the start offset).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/function.c

    r2697 r2698  
    29012901      if (length == 0)
    29022902        length = str_len - start;
    2903       else if (length < 0 && start >= -length)
    2904         return o;
    29052903      else if (length < 0)
    2906         length = str_len - start + length;
     2904        {
     2905          if (str_len <= -length)
     2906            return o;
     2907          length += str_len;
     2908          if (length <= start)
     2909            return o;
     2910          length -= start;
     2911        }
    29072912      else if (start + length > str_len)
    29082913        length = str_len - start;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette