mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* intern.h (st_foreach_safe): fix prototype.
* node.h (NODE_LMASK): bigger than long on LLP64. * missing/vsnprintf.c (BSD__uqtoa): new function to support LLP64. all changes are derived from [ruby-dev:29045] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									ddbebabd25
								
							
						
					
					
						commit
						9d6e1cdb73
					
				
					 4 changed files with 79 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -1,3 +1,12 @@
 | 
			
		|||
Tue Jul 18 15:19:07 2006  NAKAMURA Usaku  <usa@ruby-lang.org>
 | 
			
		||||
 | 
			
		||||
	* intern.h (st_foreach_safe): fix prototype.
 | 
			
		||||
 | 
			
		||||
	* node.h (NODE_LMASK): bigger than long on LLP64.
 | 
			
		||||
 | 
			
		||||
	* missing/vsnprintf.c (BSD__uqtoa): new function to support LLP64.
 | 
			
		||||
	  all changes are derived from [ruby-dev:29045]
 | 
			
		||||
 | 
			
		||||
Tue Jul 18 14:38:40 2006  Yukihiro Matsumoto  <matz@ruby-lang.org>
 | 
			
		||||
 | 
			
		||||
	* process.c (rb_f_system): call rb_sys_fail(0) if rb_last_status
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										3
									
								
								intern.h
									
										
									
									
									
								
							
							
						
						
									
										3
									
								
								intern.h
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -20,6 +20,7 @@
 | 
			
		|||
#else
 | 
			
		||||
# include <varargs.h>
 | 
			
		||||
#endif
 | 
			
		||||
#include <st.h>
 | 
			
		||||
 | 
			
		||||
/* 
 | 
			
		||||
 * Functions and variables that are used by more than one source file of
 | 
			
		||||
| 
						 | 
				
			
			@ -314,7 +315,7 @@ VALUE rb_gc_enable(void);
 | 
			
		|||
VALUE rb_gc_disable(void);
 | 
			
		||||
VALUE rb_gc_start(void);
 | 
			
		||||
/* hash.c */
 | 
			
		||||
void st_foreach_safe(struct st_table *, int (*)(ANYARGS), unsigned long);
 | 
			
		||||
void st_foreach_safe(struct st_table *, int (*)(ANYARGS), st_data_t);
 | 
			
		||||
void rb_hash_foreach(VALUE, int (*)(ANYARGS), VALUE);
 | 
			
		||||
VALUE rb_hash(VALUE);
 | 
			
		||||
VALUE rb_hash_new(void);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -349,6 +349,72 @@ BSD__sbprintf(register FILE *fp, const char *fmt, va_list ap)
 | 
			
		|||
#define is_digit(c)	((unsigned)to_digit(c) <= 9)
 | 
			
		||||
#define	to_char(n)	((n) + '0')
 | 
			
		||||
 | 
			
		||||
#ifdef _HAVE_SANE_QUAD_
 | 
			
		||||
/*
 | 
			
		||||
 * Convert an unsigned long long to ASCII for printf purposes, returning
 | 
			
		||||
 * a pointer to the first character of the string representation.
 | 
			
		||||
 * Octal numbers can be forced to have a leading zero; hex numbers
 | 
			
		||||
 * use the given digits.
 | 
			
		||||
 */
 | 
			
		||||
static char *
 | 
			
		||||
BSD__uqtoa(register u_quad_t val, char *endp, int base, int octzero, char *xdigs)
 | 
			
		||||
{
 | 
			
		||||
	register char *cp = endp;
 | 
			
		||||
	register long sval;
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * Handle the three cases separately, in the hope of getting
 | 
			
		||||
	 * better/faster code.
 | 
			
		||||
	 */
 | 
			
		||||
	switch (base) {
 | 
			
		||||
	case 10:
 | 
			
		||||
		if (val < 10) {	/* many numbers are 1 digit */
 | 
			
		||||
			*--cp = to_char(val);
 | 
			
		||||
			return (cp);
 | 
			
		||||
		}
 | 
			
		||||
		/*
 | 
			
		||||
		 * On many machines, unsigned arithmetic is harder than
 | 
			
		||||
		 * signed arithmetic, so we do at most one unsigned mod and
 | 
			
		||||
		 * divide; this is sufficient to reduce the range of
 | 
			
		||||
		 * the incoming value to where signed arithmetic works.
 | 
			
		||||
		 */
 | 
			
		||||
		if (val > LLONG_MAX) {
 | 
			
		||||
			*--cp = to_char(val % 10);
 | 
			
		||||
			sval = val / 10;
 | 
			
		||||
		} else
 | 
			
		||||
			sval = val;
 | 
			
		||||
		do {
 | 
			
		||||
			*--cp = to_char(sval % 10);
 | 
			
		||||
			sval /= 10;
 | 
			
		||||
		} while (sval != 0);
 | 
			
		||||
		break;
 | 
			
		||||
 | 
			
		||||
	case 8:
 | 
			
		||||
		do {
 | 
			
		||||
			*--cp = to_char(val & 7);
 | 
			
		||||
			val >>= 3;
 | 
			
		||||
		} while (val);
 | 
			
		||||
		if (octzero && *cp != '0')
 | 
			
		||||
			*--cp = '0';
 | 
			
		||||
		break;
 | 
			
		||||
 | 
			
		||||
	case 16:
 | 
			
		||||
		do {
 | 
			
		||||
			*--cp = xdigs[val & 15];
 | 
			
		||||
			val >>= 4;
 | 
			
		||||
		} while (val);
 | 
			
		||||
		break;
 | 
			
		||||
 | 
			
		||||
	default:			/* oops */
 | 
			
		||||
		/* 
 | 
			
		||||
		abort();
 | 
			
		||||
		*/
 | 
			
		||||
		break;	/* fjc 7-31-97.  Don't reference abort() here */
 | 
			
		||||
	}
 | 
			
		||||
	return (cp);
 | 
			
		||||
}
 | 
			
		||||
#endif /* _HAVE_SANE_QUAD_ */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Convert an unsigned long to ASCII for printf purposes, returning
 | 
			
		||||
 * a pointer to the first character of the string representation.
 | 
			
		||||
| 
						 | 
				
			
			@ -867,7 +933,7 @@ number:			if ((dprec = prec) >= 0)
 | 
			
		|||
#ifdef _HAVE_SANE_QUAD_
 | 
			
		||||
			if (flags & QUADINT) {
 | 
			
		||||
				if (uqval != 0 || prec != 0)
 | 
			
		||||
					cp = __uqtoa(uqval, cp, base,
 | 
			
		||||
					cp = BSD__uqtoa(uqval, cp, base,
 | 
			
		||||
					    flags & ALT, xdigs);
 | 
			
		||||
			} else {
 | 
			
		||||
#else /* _HAVE_SANE_QUAD_ */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								node.h
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								node.h
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -166,7 +166,7 @@ typedef struct RNode {
 | 
			
		|||
    RNODE(n)->flags=((RNODE(n)->flags&~NODE_TYPEMASK)|(((t)<<NODE_TYPESHIFT)&NODE_TYPEMASK))
 | 
			
		||||
 | 
			
		||||
#define NODE_LSHIFT (NODE_TYPESHIFT+7)
 | 
			
		||||
#define NODE_LMASK  (((long)1<<(sizeof(NODE*)*CHAR_BIT-NODE_LSHIFT))-1)
 | 
			
		||||
#define NODE_LMASK  (((VALUE)1<<(sizeof(NODE*)*CHAR_BIT-NODE_LSHIFT))-1)
 | 
			
		||||
#define nd_line(n) ((unsigned int)(((RNODE(n))->flags>>NODE_LSHIFT)&NODE_LMASK))
 | 
			
		||||
#define nd_set_line(n,l) \
 | 
			
		||||
    RNODE(n)->flags=((RNODE(n)->flags&~(-1<<NODE_LSHIFT))|(((l)&NODE_LMASK)<<NODE_LSHIFT))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue