Changeset 7a20e4c for util.c


Ignore:
Timestamp:
Feb 8, 2007, 4:39:31 PM (17 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, barnowl_perlaim, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
952b1660
Parents:
801b7ac
git-author:
Nelson Elhage <nelhage@mit.edu> (02/01/07 12:03:34)
git-committer:
Nelson Elhage <nelhage@mit.edu> (02/08/07 16:39:31)
Message:
smartnarrowing to an unclass is now the same as narrowing to the
corresponding class. We may want to make this more customizable.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • util.c

    r0138478 r7a20e4c  
    737737}
    738738
     739/* Return the base class or instance from a zephyr class, by removing
     740   leading `un' or trailing `.d'.
     741   Modified ``class'' in place, and does not allocate memory.
     742*/
     743char * owl_util_baseclass(char * class)
     744{
     745  char * end;
     746  while(!strncmp(class, "un", 2)) {
     747    class += 2;
     748  }
     749  end = class + strlen(class) - 1;
     750  while(*end == 'd' && *(end-1) == '.') {
     751    end -= 2;
     752  }
     753  *(end + 1) = 0;
     754  return class;
     755}
     756
    739757/**************************************************************************/
    740758/************************* REGRESSION TESTS *******************************/
Note: See TracChangeset for help on using the changeset viewer.