summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2000-01-25 22:57:51 +0000
committerJeremy Allison <jra@samba.org>2000-01-25 22:57:51 +0000
commitb5e7e4277d87c9eaa663f92c081a869b34170380 (patch)
tree65da8a8a5b4615cfd26e81696ef486fc1fb07d31 /source3/lib
parent014bdf941f71447909d3d98974e543fbbebfd75e (diff)
downloadsamba-b5e7e4277d87c9eaa663f92c081a869b34170380.tar.gz
samba-b5e7e4277d87c9eaa663f92c081a869b34170380.tar.bz2
samba-b5e7e4277d87c9eaa663f92c081a869b34170380.zip
First set of speed improvements from Ying Chen <ying@almaden.ibm.com>.
Inline several commonly used functions as macros. Jeremy. (This used to be commit fc0219c7cc4b83e6db17d5b3be70d74fd7971089)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/util.c138
1 files changed, 1 insertions, 137 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 001baa0e3e..0db12e92c6 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -194,15 +194,6 @@ char *get_numlist(char *p, uint32 **num, int *count)
return p;
}
-/*******************************************************************
-copy an IP address from one buffer to another
-********************************************************************/
-void putip(void *dest,void *src)
-{
- memcpy(dest,src,4);
-}
-
-
#define TRUNCATE_NETBIOS_NAME 1
/*******************************************************************
@@ -434,24 +425,6 @@ char *attrib_string(uint16 mode)
return(attrstr);
}
-
-
-/****************************************************************************
- make a file into unix format
-****************************************************************************/
-void unix_format(char *fname)
-{
- string_replace(fname,'\\','/');
-}
-
-/****************************************************************************
- make a file into dos format
-****************************************************************************/
-void dos_format(char *fname)
-{
- string_replace(fname,'/','\\');
-}
-
/*******************************************************************
show a smb message structure
********************************************************************/
@@ -496,24 +469,6 @@ void show_msg(char *buf)
dump_data(10, smb_buf(buf), bcc);
}
-/*******************************************************************
- return the length of an smb packet
-********************************************************************/
-int smb_len(char *buf)
-{
- return( PVAL(buf,3) | (PVAL(buf,2)<<8) | ((PVAL(buf,1)&1)<<16) );
-}
-
-/*******************************************************************
- set the length of an smb packet
-********************************************************************/
-void _smb_setlen(char *buf,int len)
-{
- buf[0] = 0;
- buf[1] = (len&0x10000)>>16;
- buf[2] = (len&0xFF00)>>8;
- buf[3] = len&0xFF;
-}
/*******************************************************************
set the length and marker of an smb packet
@@ -542,46 +497,6 @@ int set_message(char *buf,int num_words,int num_bytes,BOOL zero)
}
/*******************************************************************
-return the number of smb words
-********************************************************************/
-static int smb_numwords(char *buf)
-{
- return (CVAL(buf,smb_wct));
-}
-
-/*******************************************************************
-return the size of the smb_buf region of a message
-********************************************************************/
-int smb_buflen(char *buf)
-{
- return(SVAL(buf,smb_vwv0 + smb_numwords(buf)*2));
-}
-
-/*******************************************************************
- return a pointer to the smb_buf data area
-********************************************************************/
-static int smb_buf_ofs(char *buf)
-{
- return (smb_size + CVAL(buf,smb_wct)*2);
-}
-
-/*******************************************************************
- return a pointer to the smb_buf data area
-********************************************************************/
-char *smb_buf(char *buf)
-{
- return (buf + smb_buf_ofs(buf));
-}
-
-/*******************************************************************
-return the SMB offset into an SMB buffer
-********************************************************************/
-int smb_offset(char *p,char *buf)
-{
- return(PTR_DIFF(p,buf+4) + chain_size);
-}
-
-/*******************************************************************
reduce a file name, removing .. elements.
********************************************************************/
void dos_clean_name(char *s)
@@ -797,15 +712,6 @@ static void expand_one(char *Mask,int len)
}
/****************************************************************************
-parse out a directory name from a path name. Assumes dos style filenames.
-****************************************************************************/
-static void dirname_dos(char *path,char *buf)
-{
- split_at_last_component(path, buf, '\\', NULL);
-}
-
-
-/****************************************************************************
expand a wildcard expression, replacing *s with ?s
****************************************************************************/
void expand_mask(char *Mask,BOOL doext)
@@ -821,7 +727,7 @@ void expand_mask(char *Mask,BOOL doext)
/* parse the directory and filename */
if (strchr(Mask,'\\'))
- dirname_dos(Mask,dirpart);
+ split_at_last_component(Mask,dirpart,'\\',NULL);
filename_dos(Mask,filepart);
@@ -956,19 +862,6 @@ int set_blocking(int fd, BOOL set)
#undef FLAG_TO_SET
}
-
-/*******************************************************************
-find the difference in milliseconds between two struct timeval
-values
-********************************************************************/
-int TvalDiff(struct timeval *tvalold,struct timeval *tvalnew)
-{
- return((tvalnew->tv_sec - tvalold->tv_sec)*1000 +
- ((int)tvalnew->tv_usec - (int)tvalold->tv_usec)/1000);
-}
-
-
-
/****************************************************************************
transfer some data between two fd's
****************************************************************************/
@@ -1375,16 +1268,6 @@ static BOOL do_match(char *str, char *regexp, int case_sig, BOOL win9x_semantics
}
/*********************************************************
-* Routine to check if a given string matches exactly.
-* Case can be significant or not.
-**********************************************************/
-
-BOOL exact_match(char *str, char *regexp, BOOL case_sig)
-{
- return ((case_sig?strcmp(str,regexp):strcasecmp(str,regexp)) == 0);
-}
-
-/*********************************************************
* Routine to match a given string with a regexp - uses
* simplified regexp that takes * and ? only. Case can be
* significant or not.
@@ -1805,16 +1688,6 @@ BOOL get_myname(char *my_name)
return(True);
}
-
-/****************************************************************************
-true if two IP addresses are equal
-****************************************************************************/
-BOOL ip_equal(struct in_addr ip1,struct in_addr ip2)
-{
- return ip1.s_addr == ip2.s_addr;
-}
-
-
/****************************************************************************
interpret a protocol description string, with a default
****************************************************************************/
@@ -3153,15 +3026,6 @@ int set_maxfiles(int requested_max)
#endif
}
-
-/*****************************************************************
- splits out the last subkey of a key
- *****************************************************************/
-void reg_get_subkey(char *full_keyname, char *key_name, char *subkey_name)
-{
- split_at_last_component(full_keyname, key_name, '\\', subkey_name);
-}
-
/*****************************************************************
splits out the start of the key (HKLM or HKU) and the rest of the key
*****************************************************************/