Borland C++: Removed unneeded ifdefs

This commit is contained in:
Daniel Marjamäki 2009-01-07 15:16:15 +00:00
parent 0f111259b9
commit 8c71c4194f
5 changed files with 14 additions and 41 deletions

View File

@ -1,6 +1,6 @@
/*
* cppcheck - c/c++ syntax checking
* Copyright (C) 2007-2009 Daniel Marjamäki, Reijo Tomperi, Nicolas Le Cam
* Copyright (C) 2007-2009 Daniel Marjamäki, Reijo Tomperi, Nicolas Le Cam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -26,11 +26,6 @@
#include <cstring>
#include <algorithm>
#ifdef __BORLANDC__
#include <ctype.h>
#include <mem.h>
#endif
//---------------------------------------------------------------------------
CheckClass::CheckClass(const Tokenizer *tokenizer, const Settings &settings, ErrorLogger *errorLogger)
@ -97,7 +92,6 @@ struct CheckClass::VAR *CheckClass::ClassChecking_GetVarList(const Token *tok1)
if (varname)
{
struct VAR *var = new VAR;
memset(var, 0, sizeof(struct VAR));
var->name = varname;
var->init = false;
var->next = varlist;

View File

@ -1,6 +1,6 @@
/*
* cppcheck - c/c++ syntax checking
* Copyright (C) 2007-2009 Daniel Marjamäki, Reijo Tomperi, Nicolas Le Cam
* Copyright (C) 2007-2009 Daniel Marjamäki, Reijo Tomperi, Nicolas Le Cam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -26,12 +26,6 @@
#include <iostream>
#include <sstream>
#ifdef __BORLANDC__
#include <mem.h> // <- memset
#else
#include <string.h>
#endif
//---------------------------------------------------------------------------

View File

@ -1,6 +1,6 @@
/*
* cppcheck - c/c++ syntax checking
* Copyright (C) 2007-2009 Daniel Marjamäki, Reijo Tomperi, Nicolas Le Cam
* Copyright (C) 2007-2009 Daniel Marjamäki, Reijo Tomperi, Nicolas Le Cam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -25,10 +25,6 @@
#include <sstream>
#ifdef __BORLANDC__
#include <ctype>
#endif
Preprocessor::Preprocessor()
{
@ -54,7 +50,7 @@ std::string Preprocessor::read(std::istream &istr)
++lineno;
// Replace assorted special chars with spaces..
if ((ch != '\n') && (isspace(ch) || iscntrl(ch)))
if ((ch != '\n') && (std::isspace(ch) || std::iscntrl(ch)))
ch = ' ';
// Skip spaces after ' ' and after '#'

View File

@ -1,6 +1,6 @@
/*
* cppcheck - c/c++ syntax checking
* Copyright (C) 2007-2009 Daniel Marjamäki, Reijo Tomperi, Nicolas Le Cam
* Copyright (C) 2007-2009 Daniel Marjamäki, Reijo Tomperi, Nicolas Le Cam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -22,10 +22,6 @@
#include <string>
#include <iostream>
#ifdef __BORLANDC__
#include <ctype.h> // isalpha, isdigit
#endif
Token::Token() :
_str(""),
_cstr(0),
@ -50,8 +46,8 @@ void Token::str(const char s[])
_str = s;
std::free(_cstr);
_cstr = strdup(s);
_isName = bool(_str[0] == '_' || isalpha(_str[0]));
_isNumber = bool(isdigit(_str[0]) != 0);
_isName = bool(_str[0] == '_' || std::isalpha(_str[0]));
_isNumber = bool(std::isdigit(_str[0]) != 0);
if (_str == "true" || _str == "false")
_isBoolean = true;
else

View File

@ -1,6 +1,6 @@
/*
* cppcheck - c/c++ syntax checking
* Copyright (C) 2007-2009 Daniel Marjamäki, Reijo Tomperi, Nicolas Le Cam
* Copyright (C) 2007-2009 Daniel Marjamäki, Reijo Tomperi, Nicolas Le Cam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -37,12 +37,6 @@
#include <stdlib.h> // <- strtoul
#include <stdio.h>
#ifdef __BORLANDC__
#include <ctype.h>
#include <mem.h>
#endif
//---------------------------------------------------------------------------
Tokenizer::Tokenizer()
@ -102,10 +96,10 @@ void Tokenizer::Define(const char Name[], const char Value[])
bool dec = true, hex = true;
for (int i = 0; Value[i]; i++)
{
if (! isdigit(Value[i]))
if (! std::isdigit(Value[i]))
dec = false;
if (! isxdigit(Value[i]) && (!(i == 1 && Value[i] == 'x')))
if (! std::isxdigit(Value[i]) && (!(i == 1 && Value[i] == 'x')))
hex = false;
}
@ -127,7 +121,6 @@ void Tokenizer::Define(const char Name[], const char Value[])
}
DefineSymbol *NewSym = new DefineSymbol;
memset(NewSym, 0, sizeof(DefineSymbol));
NewSym->name = strdup(Name);
NewSym->value = strValue;
NewSym->next = _dsymlist;
@ -307,21 +300,21 @@ void Tokenizer::tokenizeCode(std::istream &code, const unsigned int FileIndex)
{
if (State == Space1 || State == Space2)
{
if (isspace(line[i]))
if (std::isspace(line[i]))
continue;
State = (State == Space1) ? Id : Value;
}
else if (State == Id)
{
if (isspace(line[i]))
if (std::isspace(line[i]))
{
strId = CurrentToken;
CurrentToken.clear();
State = Space2;
continue;
}
else if (! isalnum(line[i]))
else if (! std::isalnum(line[i]))
{
break;
}
@ -480,7 +473,7 @@ void Tokenizer::tokenizeCode(std::istream &code, const unsigned int FileIndex)
}
if (isspace(ch) || iscntrl(ch))
if (std::isspace(ch) || std::iscntrl(ch))
{
addtoken(CurrentToken.c_str(), lineno, FileIndex);
CurrentToken.clear();