Skip to content

Commit

Permalink
Remove unused function long_rand
Browse files Browse the repository at this point in the history
Remove also some old comments.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
  • Loading branch information
stweil committed Jul 2, 2018
1 parent 909af5d commit 3840a76
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 63 deletions.
44 changes: 2 additions & 42 deletions src/cutil/cutil.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* -*-C-*-
********************************************************************************
******************************************************************************
*
* File: cutil.cpp
* Description: General utility functions
Expand All @@ -21,21 +21,7 @@
** See the License for the specific language governing permissions and
** limitations under the License.
*
********************************************************************************
Revision 1.1 2007/02/02 23:39:07 theraysmith
Fixed portability issues
Revision 1.1.1.1 2004/02/20 19:39:06 slumos
Import original HP distribution
* Revision 1.3 90/03/06 15:39:10 15:39:10 marks (Mark Seaman)
* Look for correct file of <malloc.h> or <stdlib.h>
*
* Revision 1.2 90/01/15 13:02:13 13:02:13 marks (Mark Seaman)
* Added memory allocator (*allocate) and (*deallocate)
*
* Revision 1.1 89/10/09 14:58:29 14:58:29 marks (Mark Seaman)
* Initial revision
******************************************************************************
**/

#include "cutil.h"
Expand All @@ -46,32 +32,6 @@ Import original HP distribution

#define RESET_COUNT 2000

/**********************************************************************
* long_rand
*
* Return a long random number whose value is less than limit. Do this
* by calling the standard cheepo random number generator and resetting
* it pretty often.
**********************************************************************/
long long_rand(long limit) {
#if RAND_MAX < 0x1000000
static long seed;

long num;
num = (long) rand () << 16;
num |= rand () & 0xffff;
seed ^= num;
long result = num % limit;
while (result < 0) {
result += limit;
}
return result;
#else
return (long)((double)limit * rand()/(RAND_MAX + 1.0));
#endif
}


/**********************************************************************
* open_file
*
Expand Down
24 changes: 3 additions & 21 deletions src/cutil/cutil.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* -*-C-*-
********************************************************************************
******************************************************************************
*
* File: cutil.h
* Description: General utility functions
Expand All @@ -21,14 +21,8 @@
** See the License for the specific language governing permissions and
** limitations under the License.
*
********************************************************************************
Revision 1.1 2007/02/02 23:39:07 theraysmith
Fixed portability issues
Revision 1.1.1.1 2004/02/20 19:39:06 slumos
Import original HP distribution
*/
******************************************************************************
*/

#ifndef CUTILH
#define CUTILH
Expand Down Expand Up @@ -62,7 +56,6 @@ Import original HP distribution
# define _ARGS(s) ()
#endif

//typedef int (*int_proc) (void);
typedef void (*void_proc) (...);
typedef void *(*void_star_proc) _ARGS ((...));

Expand Down Expand Up @@ -95,21 +88,10 @@ typedef void (*void_dest) (void *);
/*----------------------------------------------------------------------
F u n c t i o n s
----------------------------------------------------------------------*/
long long_rand(long limit);

FILE *open_file(const char *filename, const char *mode);

bool exists_file(const char *filename);

/* util.c
long long_rand
_ARGS ((long limit));
FILE *open_file
_ARGS((char *filename,
char *mode));
#undef _ARGS
*/
#include "cutil_class.h"
#endif

0 comments on commit 3840a76

Please sign in to comment.