Enrique Perez-Terron <en...@online.no> writes:

| On Thu, 2009-12-17 at 00:43 +0300, Aleksej Saushev wrote:
| > Hello!

Hello!  Happy new year to all open-axiomatizers.

| > 
| > I need this for both, FriCAS and OpenAxiom, to build last released versions,
| > I also think it is good idea anyway:
| > 
| > $NetBSD: patch-ab,v 1.1 2009/12/15 23:36:29 asau Exp $
| > 
| > Reuse strcmp to simplify logic and fix build.
| > Shared between FriCAS and OpenAxiom.

Thanks for the patch.  And apologies for the delay in answering.
My December 2009 schedule got, for the most part, out of hand.

| > 
| > --- src/hyper/addfile.c.orig        2009-07-10 00:50:28.000000000 +0400
| > +++ src/hyper/addfile.c     2009-12-15 22:32:55.000000000 +0300
| > @@ -50,13 +50,7 @@
| >  strpostfix(char *s, char *t)
| >  {
| >      int slen = strlen(s), tlen = strlen(t);
| > -
| > -    if (tlen > slen)
| > -        return 0;
| > -    while (tlen > 0)
| > -        if (s[--slen] != t[--tlen])
| > -            return 0;
| > -    return 1;
| > +    return (tlen < slen) && !strcmp(s+slen-tlen, t);
| 
| I have no idea how this is used, or what is correct,
| but should the case tlen == slen always return false?

I've retained this aspect in the revised patch of Aleksej.  See below.
Applied to both 1.3.x series and trunk.

Aleksej, please could you check that the new version builds correctly
for you?  Thanks!

-- Gaby

*** ChangeLog   (revision 14343)
--- ChangeLog   (local)
***************
*** 0 ****
--- 1,4 ----
+ 2010-01-03  Aleksej Saushev  <a...@inbox.ru>
+ 
+       * hyper/addfile.c (strpostfix): Simplify.
+ 
*** hyper/addfile.c     (revision 14343)
--- hyper/addfile.c     (local)
***************
*** 50,71 ****
  
  static int build_ht_filename(char*, char*, char*);
  static int pathname(char*);
- static int strpostfix(char*, char*);
- 
  
  char *gDatabasePath = NULL;
  
  static int
! strpostfix(char *s, char *t)
  {
!     int slen = strlen(s), tlen = strlen(t);
! 
!     if (tlen > slen)
!         return 0;
!     while (tlen > 0)
!         if (s[--slen] != t[--tlen])
!             return 0;
!     return 1;
  }
  
  /* extend_ht : just checks the name and adds a .ht if needed */
--- 50,65 ----
  
  static int build_ht_filename(char*, char*, char*);
  static int pathname(char*);
  
  char *gDatabasePath = NULL;
  
+ /* Return non-zero if the string T is a postfix of S.  */
  static int
! strpostfix(const char *s, const char *t)
  {
!     const int slen = strlen(s);
!     const int tlen = strlen(t);
!     return tlen <= slen && strcmp(s + slen - tlen, t) == 0;
  }
  
  /* extend_ht : just checks the name and adds a .ht if needed */

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
open-axiom-devel mailing list
open-axiom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open-axiom-devel

Reply via email to