File: checkused.cpp

package info (click to toggle)
sludge 2.2.2-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,852 kB
  • sloc: cpp: 32,432; sh: 1,237; makefile: 634; xml: 284
file content (39 lines) | stat: -rw-r--r-- 809 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <string.h>
#include "splitter.hpp"
#include "helpers.h"
#include "messbox.h"
#include "checkused.h"

static bool * flagUsed[CHECKUSED_NUM];

void checkUsedInit (int type, int n)
{
	flagUsed[type] = new bool[n];
	memset (flagUsed[type], 0, sizeof(bool) * n);
}

void warnAboutUnused (int type, stringArray * temp, const char * preamble, stringArray * files) {
	int i = 0;

	if (! flagUsed[type])
		return;

	while (temp)
	{
		if (! flagUsed[type][i])
		{
			char * buff = joinStrings (preamble, temp->string, " not used");
			addCommentWithLine(ERRORTYPE_PROJECTWARNING, buff, files ? files->string : 0, temp->line);
			delete buff;
		}
		i ++;
		temp = temp->next;
		files = files ? files->next : 0;
	}
}

void setUsed (int type, int i)
{
	if (i >= 0 && flagUsed[type])
		flagUsed[type][i] = true;
}