Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7241


Ignore:
Timestamp:
Aug 28, 2010, 7:03:06 PM (14 years ago)
Author:
rgrieder
Message:

This is a little prettier.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/consolecommands3/src/libraries/util/StringUtils.cc

    r7240 r7241  
    3535
    3636#include <cctype>
     37#include <boost/scoped_array.hpp>
    3738#include "Convert.h"
    3839#include "Math.h"
     
    538539        size_t cols = str1.size() + 1;
    539540        size_t rows = str2.size() + 1;
    540         int* matrix = new int[rows * cols];
     541        boost::scoped_array<int> matrix(new int[rows * cols]);
    541542
    542543        for (size_t r = 0; r < rows; ++r)
     
    559560                                              matrix[(r-1)*cols + c-1] + (str1[c-1] != str2[r-1]));
    560561
    561         int result = matrix[(rows-1)*cols + cols-1];
    562         delete[] matrix;
    563         return result;
     562        return matrix[(rows-1)*cols + cols-1];
    564563    }
    565564}
Note: See TracChangeset for help on using the changeset viewer.