The expiration time for new job artifacts in CI/CD pipelines is now 30 days (GitLab default). Previously generated artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

libname.c 1.13 KB
Newer Older
1
2
3
4
5
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <setjmp.h>
#include <time.h>
6
#include "libconfig.h"
7
8
9
10
#include "libtype.h"
#include "libglobals.h"
#include <setjmp.h>
#include "libname.h"
11
extern jmp_buf mmix_exit;
Martin Ruckert's avatar
Martin Ruckert committed
12
13
/* simple implementation of the identity mapping */

14
15
16
#define NUM_FILES 0x100
static char *filenames[NUM_FILES]={NULL};
static char file_no_bound= 0;
Martin Ruckert's avatar
Martin Ruckert committed
17

18
19
20
21
22
23
24
25
26
27
28
int filename2file(char *filename)
{ int file_no;
  file_no=0;
  while(file_no<file_no_bound)
  { if (filenames[file_no]!=NULL && strcmp(filenames[file_no],filename)==0)
      return file_no;
    file_no++;
  }
  if (file_no>=NUM_FILES)
  { MMIX_ERROR("Too many open files (%s)!\n",filename);  
    return -1;
29
  }
30
31
32
33
  filenames[file_no]=malloc(strlen(filename)+1);
  if (filenames[file_no]==NULL)
  { MMIX_ERROR("Out of memory for filename (%s)!\n",filename);  
    return -1;
34
  }
35
36
37
  strcpy(filenames[file_no],filename);
  if (file_no>=file_no_bound) file_no_bound= file_no+1;
  return file_no;
Martin Ruckert's avatar
Martin Ruckert committed
38
39
}

40
41
42
43
44
45
46
char *file2filename(int file_no)
{ 
  if (file_no<0 || file_no>=NUM_FILES) 
	   return NULL;
   else
	   return filenames[file_no];
}