Use new T not new T()

This commit is contained in:
Lars Gullik Bjønnes 2012-10-26 02:42:27 +02:00
parent 43f6b1672b
commit d52c9fda34
10 changed files with 16 additions and 16 deletions

View File

@ -493,7 +493,7 @@ Buffer::~Buffer()
Buffer * Buffer::cloneFromMaster() const Buffer * Buffer::cloneFromMaster() const
{ {
BufferMap bufmap; BufferMap bufmap;
cloned_buffers.push_back(new CloneList()); cloned_buffers.push_back(new CloneList);
CloneList * clones = cloned_buffers.back(); CloneList * clones = cloned_buffers.back();
masterBuffer()->cloneWithChildren(bufmap, clones); masterBuffer()->cloneWithChildren(bufmap, clones);
@ -549,7 +549,7 @@ void Buffer::cloneWithChildren(BufferMap & bufmap, CloneList * clones) const
Buffer * Buffer::cloneBufferOnly() const { Buffer * Buffer::cloneBufferOnly() const {
cloned_buffers.push_back(new CloneList()); cloned_buffers.push_back(new CloneList);
CloneList * clones = cloned_buffers.back(); CloneList * clones = cloned_buffers.back();
Buffer * buffer_clone = new Buffer(fileName().absFileName(), false, this); Buffer * buffer_clone = new Buffer(fileName().absFileName(), false, this);
clones->insert(buffer_clone); clones->insert(buffer_clone);

View File

@ -1424,7 +1424,7 @@ void setSpellChecker()
if (lyxrc.spellchecker == "native") { if (lyxrc.spellchecker == "native") {
#if defined(USE_MACOSX_PACKAGING) #if defined(USE_MACOSX_PACKAGING)
if (!singleton_->pimpl_->apple_spell_checker_) if (!singleton_->pimpl_->apple_spell_checker_)
singleton_->pimpl_->apple_spell_checker_ = new AppleSpellChecker(); singleton_->pimpl_->apple_spell_checker_ = new AppleSpellChecker;
singleton_->pimpl_->spell_checker_ = singleton_->pimpl_->apple_spell_checker_; singleton_->pimpl_->spell_checker_ = singleton_->pimpl_->apple_spell_checker_;
#else #else
singleton_->pimpl_->spell_checker_ = 0; singleton_->pimpl_->spell_checker_ = 0;
@ -1432,7 +1432,7 @@ void setSpellChecker()
} else if (lyxrc.spellchecker == "aspell") { } else if (lyxrc.spellchecker == "aspell") {
#if defined(USE_ASPELL) #if defined(USE_ASPELL)
if (!singleton_->pimpl_->aspell_checker_) if (!singleton_->pimpl_->aspell_checker_)
singleton_->pimpl_->aspell_checker_ = new AspellChecker(); singleton_->pimpl_->aspell_checker_ = new AspellChecker;
singleton_->pimpl_->spell_checker_ = singleton_->pimpl_->aspell_checker_; singleton_->pimpl_->spell_checker_ = singleton_->pimpl_->aspell_checker_;
#else #else
singleton_->pimpl_->spell_checker_ = 0; singleton_->pimpl_->spell_checker_ = 0;
@ -1440,7 +1440,7 @@ void setSpellChecker()
} else if (lyxrc.spellchecker == "enchant") { } else if (lyxrc.spellchecker == "enchant") {
#if defined(USE_ENCHANT) #if defined(USE_ENCHANT)
if (!singleton_->pimpl_->enchant_checker_) if (!singleton_->pimpl_->enchant_checker_)
singleton_->pimpl_->enchant_checker_ = new EnchantChecker(); singleton_->pimpl_->enchant_checker_ = new EnchantChecker;
singleton_->pimpl_->spell_checker_ = singleton_->pimpl_->enchant_checker_; singleton_->pimpl_->spell_checker_ = singleton_->pimpl_->enchant_checker_;
#else #else
singleton_->pimpl_->spell_checker_ = 0; singleton_->pimpl_->spell_checker_ = 0;
@ -1448,7 +1448,7 @@ void setSpellChecker()
} else if (lyxrc.spellchecker == "hunspell") { } else if (lyxrc.spellchecker == "hunspell") {
#if defined(USE_HUNSPELL) #if defined(USE_HUNSPELL)
if (!singleton_->pimpl_->hunspell_checker_) if (!singleton_->pimpl_->hunspell_checker_)
singleton_->pimpl_->hunspell_checker_ = new HunspellChecker(); singleton_->pimpl_->hunspell_checker_ = new HunspellChecker;
singleton_->pimpl_->spell_checker_ = singleton_->pimpl_->hunspell_checker_; singleton_->pimpl_->spell_checker_ = singleton_->pimpl_->hunspell_checker_;
#else #else
singleton_->pimpl_->spell_checker_ = 0; singleton_->pimpl_->spell_checker_ = 0;

View File

@ -37,7 +37,7 @@ WordList * theWordList(Language const & lang)
if (it != theGlobalWordList.end()) if (it != theGlobalWordList.end())
return it->second; return it->second;
else else
theGlobalWordList[lang] = new WordList(); theGlobalWordList[lang] = new WordList;
return theGlobalWordList[lang]; return theGlobalWordList[lang];
} }

View File

@ -737,7 +737,7 @@ struct GuiApplication::Private
{ {
#ifdef Q_WS_WIN #ifdef Q_WS_WIN
/// WMF Mime handler for Windows clipboard. /// WMF Mime handler for Windows clipboard.
wmf_mime_ = new QWindowsMimeMetafile(); wmf_mime_ = new QWindowsMimeMetafile;
#endif #endif
initKeySequences(&theTopLevelKeymap()); initKeySequences(&theTopLevelKeymap());
} }
@ -2145,7 +2145,7 @@ void GuiApplication::execBatchCommands()
// Create the global default menubar which is shown for the dialogs // Create the global default menubar which is shown for the dialogs
// and if no GuiView is visible. // and if no GuiView is visible.
// This must be done after the session was recovered to know the "last files". // This must be done after the session was recovered to know the "last files".
d->global_menubar_ = new GlobalMenuBar(); d->global_menubar_ = new GlobalMenuBar;
d->menus_.fillMenuBar(d->global_menubar_, 0, true); d->menus_.fillMenuBar(d->global_menubar_, 0, true);
#endif #endif

View File

@ -66,7 +66,7 @@ static QMimeData const * read_clipboard()
qApp->clipboard()->mimeData(QClipboard::Clipboard); qApp->clipboard()->mimeData(QClipboard::Clipboard);
if (!source) { if (!source) {
LYXERR0("0 bytes (no QMimeData)"); LYXERR0("0 bytes (no QMimeData)");
return new QMimeData(); return new QMimeData;
} }
// It appears that doing IO between getting a mimeData object // It appears that doing IO between getting a mimeData object
// and using it can cause a crash (maybe Qt used IO // and using it can cause a crash (maybe Qt used IO

View File

@ -52,7 +52,7 @@ GuiProgressView::GuiProgressView(GuiView & parent, Qt::DockWidgetArea area,
: DockView(parent, "progress", qt_("Progress/Debug Messages"), area, flags) : DockView(parent, "progress", qt_("Progress/Debug Messages"), area, flags)
{ {
eol_last_ = true; eol_last_ = true;
widget_ = new ProgressViewWidget(); widget_ = new ProgressViewWidget;
widget_->setMinimumHeight(150); widget_->setMinimumHeight(150);
widget_->debugMessagesTW->setSizePolicy(QSizePolicy::Ignored, widget_->debugMessagesTW->setSizePolicy(QSizePolicy::Ignored,
QSizePolicy::Expanding); QSizePolicy::Expanding);

View File

@ -238,7 +238,7 @@ struct GuiView::GuiViewPrivate
// TODO cleanup, remove the singleton, handle multiple Windows? // TODO cleanup, remove the singleton, handle multiple Windows?
progress_ = ProgressInterface::instance(); progress_ = ProgressInterface::instance();
if (!dynamic_cast<GuiProgress*>(progress_)) { if (!dynamic_cast<GuiProgress*>(progress_)) {
progress_ = new GuiProgress(); // TODO who deletes it progress_ = new GuiProgress; // TODO who deletes it
ProgressInterface::setInstance(progress_); ProgressInterface::setInstance(progress_);
} }
QObject::connect( QObject::connect(

View File

@ -231,7 +231,7 @@ GuiViewSource::GuiViewSource(GuiView & parent,
Qt::DockWidgetArea area, Qt::WindowFlags flags) Qt::DockWidgetArea area, Qt::WindowFlags flags)
: DockView(parent, "view-source", qt_("LaTeX Source"), area, flags) : DockView(parent, "view-source", qt_("LaTeX Source"), area, flags)
{ {
widget_ = new ViewSourceWidget(); widget_ = new ViewSourceWidget;
setWidget(widget_); setWidget(widget_);
} }

View File

@ -86,7 +86,7 @@ PanelStack::PanelStack(QWidget * parent)
// Create the output layout, horizontal plus a VBox on the left with the search // Create the output layout, horizontal plus a VBox on the left with the search
// box and the tree // box and the tree
QVBoxLayout * left_layout = new QVBoxLayout(); QVBoxLayout * left_layout = new QVBoxLayout;
left_layout->addWidget(search_, 0); left_layout->addWidget(search_, 0);
left_layout->addWidget(list_, 1); left_layout->addWidget(list_, 1);

View File

@ -757,7 +757,7 @@ void InsetListingsParams::addParam(string const & key,
// check onoff flag // check onoff flag
// onoff parameter with value false // onoff parameter with value false
if (!par_validator) if (!par_validator)
par_validator = new ParValidator(); par_validator = new ParValidator;
if (par_validator->onoff(key) && (value == "false" || value == "{false}")) if (par_validator->onoff(key) && (value == "false" || value == "{false}"))
params_[keyname] = string(); params_[keyname] = string();
// if the parameter is surrounded with {}, good // if the parameter is surrounded with {}, good
@ -884,7 +884,7 @@ docstring InsetListingsParams::validate() const
{ {
docstring msg; docstring msg;
if (!par_validator) if (!par_validator)
par_validator = new ParValidator(); par_validator = new ParValidator;
for (map<string, string>::const_iterator it = params_.begin(); for (map<string, string>::const_iterator it = params_.begin();
it != params_.end(); ++it) { it != params_.end(); ++it) {
msg = par_validator->validate(it->first, it->second); msg = par_validator->validate(it->first, it->second);