CVS update: php3

From: Date: Fri, 04 Dec 1998 16:35:52 +0000
Subject: CVS update: php3
Groups: php.dev 
Request: Send a blank email to php-dev+get-2658@lists.php.net to get a copy of this message
Date: Friday December 4, 1998 @ 11:35 Author: ssb Update of /repository/php3 In directory asf:/u/temp/cvs-serv23154 Modified Files: variables.c variables.h Log Message: Four new API functions: pval *php3i_long_pval(long); pval *php3i_double_pval(double); pval *php3i_string_pval(const char *); char *php3i_pval_strdup(pval *); Index: php3/variables.c diff -c php3/variables.c:1.158 php3/variables.c:1.159 *** php3/variables.c:1.158 Fri Oct 23 17:02:41 1998 --- php3/variables.c Fri Dec 4 11:35:48 1998 *************** *** 29,35 **** */ ! /* $Id: variables.c,v 1.158 1998/10/23 21:02:41 shane Exp $ */ #ifdef THREAD_SAFE #include "tls.h" --- 29,35 ---- */ ! /* $Id: variables.c,v 1.159 1998/12/04 16:35:48 ssb Exp $ */ #ifdef THREAD_SAFE #include "tls.h" *************** *** 717,722 **** --- 717,768 ---- TLS_VARS; return &GLOBAL(function_table); } + + + PHPAPI pval *php3i_long_pval(long value) + { + pval *ret = emalloc(sizeof(pval)); + + ret->type = IS_LONG; + ret->value.lval = value; + return ret; + } + + + PHPAPI pval *php3i_double_pval(double value) + { + pval *ret = emalloc(sizeof(pval)); + + ret->type = IS_DOUBLE; + ret->value.dval = value; + return ret; + } + + + PHPAPI pval *php3i_string_pval(const char *str) + { + pval *ret = emalloc(sizeof(pval)); + int len = strlen(str); + + ret->type = IS_STRING; + ret->value.str.len = len; + ret->value.str.val = estrndup(str, len); + return ret; + } + + + PHPAPI char *php3i_pval_strdup(pval *val) + { + if (val->type == IS_STRING) { + char *buf = emalloc(val->value.str.len + 1); + memcpy(buf, val->value.str.val, val->value.str.len); + buf[val->value.str.len] = '\0'; + return buf; + } + return NULL; + } + + /* * Local variables: * tab-width: 4 Index: php3/variables.h diff -c php3/variables.h:1.52 php3/variables.h:1.53 *** php3/variables.h:1.52 Fri Oct 23 17:02:43 1998 --- php3/variables.h Fri Dec 4 11:35:52 1998 *************** *** 29,35 **** */ ! /* $Id: variables.h,v 1.52 1998/10/23 21:02:43 shane Exp $ */ #ifndef _VARIABLES_H --- 29,35 ---- */ ! /* $Id: variables.h,v 1.53 1998/12/04 16:35:52 ssb Exp $ */ #ifndef _VARIABLES_H *************** *** 71,75 **** --- 71,80 ---- extern void read_pointer_value(pval *result,pval *array_result INLINE_TLS); extern inline void get_regular_variable_pointer(pval *result, pval *varname INLINE_TLS); + + extern PHPAPI pval *php3i_long_pval(long); + extern PHPAPI pval *php3i_double_pval(double); + extern PHPAPI pval *php3i_string_pval(const char *); + extern PHPAPI char *php3i_pval_strdup(pval *); #endif -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#2658) next »