Skip to content

Commit 3a23364

Browse files
committed
Comment lines are removed
1 parent 84f97b2 commit 3a23364

File tree

2 files changed

+14
-28
lines changed

2 files changed

+14
-28
lines changed

kernel-data-structure-lab1/clientBridge.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,24 +109,19 @@ char* getPathFile(){
109109
return pathfile;
110110
}
111111

112-
void validarSimetria(int fd,char *file,int numOfLines){
112+
void validarSimetria(int fd,char **file,int numOfLines){
113113
char test[100];
114114
ioctl(fd, BRIDGE_W_S, "Hola este es un mensaje a la pila \n");
115115
ioctl(fd, BRIDGE_R_S, test);
116116
printf("%s\n",test);
117117
}
118+
118119
void chooseOption(char* option){
119-
120+
120121
int fd = callModule();
121122
char* pathfile = getPathFile();
122123
int numOfLines = 0;
123-
char **linesArray=readFile(pathfile,&numOfLines);
124-
printf("informacion del archivo : \n");
125-
for ( int i = 0; i < numOfLines; i++)
126-
{
127-
printf("%s",linesArray[i]);
128-
}
129-
printf("\n");
124+
char **linesArray = readFile(pathfile,&numOfLines);
130125

131126
if(strcmp(ORDEN_INVERSO, option) == 0){
132127

kernel-data-structure-lab1/utilsClientBridge.c

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,44 +16,36 @@ void killClientBridge(char* message){
1616
exit(-1);
1717
}
1818

19-
2019
char** readFile(char* fileName,int *numOfLines){
21-
FILE* input_file = fopen(fileName, "r");
22-
if (!input_file){
20+
FILE* inputFile = fopen(fileName, "r");
21+
if (!inputFile){
2322
exit(EXIT_FAILURE);
2423
}
2524
int lines = 0;
26-
numberOfLines(input_file, &lines);
27-
printf("cantidad lineas: %d\n",lines);
28-
rewind(input_file);
25+
numberOfLines(inputFile, &lines);
26+
rewind(inputFile);
2927
char** arrayChars = malloc(sizeof(char*) * lines);
3028
char* contents = NULL;
3129
size_t len = 0;
3230
int i = 0;
33-
while (getline(&contents, &len, input_file) != -1){
31+
while (getline(&contents, &len, inputFile) != -1){
3432
int cm = stringLength(contents);
3533
char* newChars = (char*)malloc(cm);
3634
strcpy(newChars, contents);
3735
arrayChars[i] = (char*)malloc(cm);
3836
arrayChars[i] = newChars;
39-
// printf("%s\n", newChars);
4037
i++;
41-
4238
}
43-
// for (int i = 0; i < lines; i++)
44-
// {
45-
// printf("vector = %s\n",arrayChars[i]);
46-
// }
47-
fclose(input_file);
39+
40+
fclose(inputFile);
4841
free(contents);
4942
*numOfLines=lines;
50-
return arrayChars;
43+
return arrayChars;
5144
}
5245

5346
int stringLength(char * arrayChar){
5447
int i = 0;
55-
while (arrayChar[i]!='\0')
56-
{
48+
while (arrayChar[i]!='\0'){
5749
i++;
5850
}
5951
return i;
@@ -67,10 +59,9 @@ int numberOfLines(FILE* file, int* size){
6759
if(character == '\n'){
6860
i++;
6961
}
70-
if(character == EOF){ //Si el caracter es end of file imprimimos el contador y salimos del while
62+
if(character == EOF){
7163
i++;
7264
*size = i;
73-
// printf("%d\n",i); //El número de lineas
7465
break;
7566
}
7667
}

0 commit comments

Comments
 (0)