<commit_before>#ifndef CT_UNITS_H
#define CT_UNITS_H

#include "ct_defs.h"

namespace Cantera {

    class Unit {
    public:

        static Unit* units() {
            if (!__u) __u = new Unit;
            return __u;
        }

        virtual ~Unit() {
            delete __u;
            __u = 0;
        }

        doublereal actEnergyToSI(string units) {
            if (m_act_u.find(units) != m_act_u.end()) {
                return m_act_u[units];
            }
            else {
                return toSI(units);
            }
        }

        doublereal toSI(string units) {
            if (units == "") return 1.0;
            doublereal f = 1.0, fctr;
            int tsize;
            string u = units, tok, tsub;
            int k;
            char action = '-';
            //if (units[0] == '/') action = '/';
            while (1 > 0) {
                k = u.find_first_of("/-");
                if (k >= 0)
                    tok = u.substr(0,k);
                else
                    tok = u;<commit_msg>fixed a potentially fatal error of doing a delete in a destructor on the object containing the destructor.<commit_after>#ifndef CT_UNITS_H
#define CT_UNITS_H

#include "ct_defs.h"

namespace Cantera {

    class Unit {
    public:

        static Unit* units() {
            if (!__u) __u = new Unit;
            return __u;
        }

	static void deleteUnit() {
	    if (__u) {
	      delete __u;
	      __u = 0;
	    }
	}

        virtual ~Unit() {
        }

        doublereal actEnergyToSI(string units) {
            if (m_act_u.find(units) != m_act_u.end()) {
                return m_act_u[units];
            }
            else {
                return toSI(units);
            }
        }

        doublereal toSI(string units) {
            if (units == "") return 1.0;
            doublereal f = 1.0, fctr;
            int tsize;
            string u = units, tok, tsub;
            int k;
            char action = '-';
            //if (units[0] == '/') action = '/';
            while (1 > 0) {
                k = u.find_first_of("/-");
                if (k >= 0)
                    tok = u.substr(0,k);
                else
                    tok = u;
{'fraction_non_alphanumeric': 0.11468721668177698, 'fraction_numerical': 0.009066183136899365, 'mean_word_length': 1.124157844080847, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4509965', 'n_tokens_mistral': 710, 'n_tokens_neox': 657, 'n_words': 173}